Chapter 10. Properties

In this chapter:

Parameterless Properties

Parameterful Properties

The Performance of Calling Property Accessor Methods

Property Accessor Accessibility

Generic Property Accessor Methods

In this chapter, I’ll talk about properties. Properties allow source code to call a method by using a simplified syntax. The common language runtime (CLR) offers two kinds of properties: parameterless properties, which are simply called properties, and parameterful properties, which are called different names by different programming languages. For example, C# calls parameterful properties indexers, and Microsoft Visual Basic calls them default properties. I’ll also talk about initializing properties by using object and collection initializers, ...

Get CLR via C#, Fourth Edition 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.