Join Reynald Adolphe for an in-depth discussion in this video Using properties correctly, part of C# Best Practices for Developers.
- [Instructor] When I first started coding,…I was once told by a colleague…that I can think of a property as a smart field,…but as I got more experience I realized…that it really didn't do it justice…with that definition.…You can think of a property as a member that provides…a flexible mechanism to read, write,…or compute the value of a private field.…Properties could be used as if they are public data members…but they are actually special methods called accessors,…and this enables data to be accessed easily,…and still helps promote the safety…and flexibility of methods,…and they can do this because they have getters…and setters,…and the code that we can put into these getters and setters…depends on three things:…what the property is, how it will be used,…and the protection that it requires.…
So for example, code that you could have…in getters and setters…can be to check the user credentials,…especially if the property is accessible…to specific users like admins,…or checking the application state,…like if the property is only available…
- Naming and handling classes
- Running a unit test
- Using constructors
- Naming and handling methods, fields, and properties
- Using properties correctly
- Managing objects efficiently
- Common design patterns as best practices
Skill Level Intermediate
1. Best Practices: An Overview
2. Naming and Handling Classes
3. Naming and Handling Methods, Fields, and Properties
4. Managing Objects Efficiently
5. More Best Practices Resources
- Mark as unwatched
- Mark all as unwatched
Are you sure you want to mark all the videos in this course as unwatched?
This will not affect your course history, your reports, or your certificates of completion for this course.Cancel
Take notes with your new membership!
Type in the entry box, then click Enter to save your note.
1:30Press on any video thumbnail to jump immediately to the timecode shown.
Notes are saved with you account but can also be exported as plain text, MS Word, PDF, Google Doc, or Evernote.