Chapter 8. Properties, Indexers, and Operators

Properties are class members that allow you to expose a characteristic of an object. Indexers are members that allow you to treat a class as though it were an array, using the same index syntax ([]) that is described in Chapter 13.

Properties and indexers both allow you to control access to the fields in your class and give you more control than exposing a field directly. As you'll see when we get into the detail, properties and indexers are very flexible; in fact, they are so rich that they can sometimes blur the distinction between fields and methods.

Custom operators allow you to implement custom operations using standard notation such as + and ++ and allow you to control the implicit and explicit ...

Get Introducing Visual C# 2010 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.