C# Tutorials - Properties, Arrays, and Indexers
So far, I've described the basic types supported by C# and how to declare and use them in your classes and applications. This tutorial will break the pattern of presenting one major feature of the language per tutorial. In this tutorial, you'll learn about properties, arrays, and indexers because these language features share a common bond. They enable you, the C# class developer, to extend the basic class/field/method structure of a class to expose a more intuitive and natural interface to your class's members.
It's always a good goal to design classes that not only hide the implementation of the class's methods, but that also disallow any direct member access to the class's fields. By providing accessor methods whose job it is to retrieve and set the values of these fields, you can be assured that a field is treated correctly-that is, according to the rules of your specific problem domain-and that any additional processing that's needed is performed.
Table of content (tutorial index)