Summary

In this chapter, you learned about the following function class members: properties, indexers, user-defined operator overloading, and user-defined conversions. We also looked at another kind of class member called nested types. The most important points in this chapter are noted in the following paragraphs.

Properties are better suited than accessor and mutator methods to access instance variables. The property is accessed in the same way as a public instance variable, but when a value is assigned or retrieved via the property, programmer defined set statement blocks and get statement blocks are executed. A property does not have to represent any particular instance variable but can merely return a calculated value.

Properties are as ...

Get C# Primer Plus 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.