Skip to Content
Microsoft® Visual C#® 2012 Step by Step
book

Microsoft® Visual C#® 2012 Step by Step

by John Sharp
December 2012
Beginner to intermediate content levelBeginner to intermediate
844 pages
25h 38m
English
Microsoft Press
Content preview from Microsoft® Visual C#® 2012 Step by Step

Chapter 16. Using Indexers

After completing this chapter, you will be able to

  • Encapsulate logical arraylike access to an object by using indexers.

  • Control read access to indexers by declaring get accessors.

  • Control write access to indexers by declaring set accessors.

  • Create interfaces that declare indexers.

  • Implement indexers in structures and classes that inherit from interfaces.

Chapter 15, 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 by using a natural and familiar syntax.

What Is an Indexer?

You can think of an ...

Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Start your free trial

You might also like

Microsoft® Visual C#® 2008 Step by Step

Microsoft® Visual C#® 2008 Step by Step

John Sharp
Beginning Microsoft® Visual C#® 2008

Beginning Microsoft® Visual C#® 2008

Karli Watson, Christian Nagel, Jacob Hammer Pedersen, Jon D. Reid, Morgan Skinner, Eric White

Publisher Resources

ISBN: 9780735679375Purchase book