Properties
Properties are class members that provide specialized access to class fields. They provide encapsulation for a class, so users are unaware of the underlying implementation required to access a class field. Their use is also transparent to the calling program.
For C++ ProgrammersProperties are a new programming construct. In C++ you would use explicit get/set methods to encapsulate properties. These methods are called to access class attributes. However, in C# the property name is used as if it were a field itself. |
For Java ProgrammersJava formalized accessors through predefined signature patterns. However, they were still methods. C# properties are not methods. They provide the means to access a field by using the property as if ... |
Get C# Unleashed now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.