Chapter 16
Handling binary data and using indexers
After completing this chapter, you will be able to:
Explain the purpose of indexers and create and use indexers to encapsulate logical array-like access to an object.
Control read and write access to indexers by declaring accessors.
Create interfaces that declare indexers.
Implement indexers in structures and classes that inherit from interfaces.
Chapter 15, “Implementing properties to access fields,” described how to implement and use properties as a means of providing controlled access to the fields in a class. Properties are useful for mirroring fields that contain a single value. However, indexers are invaluable if you want to provide access to items that contain multiple values, and to ...
Get Microsoft Visual C# Step by Step, 10th 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.