Indexers

  • Indexer is a concept of using an object like an array.

    Syntax:

    <modifier> <return type> this [argument list]

  • Indexers are implemented through get and set assessors for the [] operator. . The get and set assessors are invoked as methods with the parameter list specified in the indexer declaration.
  • Indexer method name must be this.
  • One class can have only one indexer.
  • The modifier can be private, public, protected or internal.
  • Indexers must be instance-based, that is, they cannot be static i.e., C# don't have the concept of static indexers
  • A base class indexer is inherited to the derived class.

0 comments :

Post a Comment

> Related Posts with Thumbnails
 

Copyright © 2012. GS dot net - All Rights Reserved - Design by BTDesigner - Proudly powered by Blogger