Please visit DEMANDDRAFT.SHOP for quality of products...

Ad

Search This Blog

Saturday, June 16, 2012

Difference between Properties and Indexers:

Difference between Properties and Indexers:
Property:
  • Allows methods to be called as though they were public data members.
  • Accessed through a simple name.
  • Can be a static or an instance member.
  • A getaccessor of a property has no parameters.
  • A setaccessor of a property contains the implicit value parameter.
Indexers:
  • Allows methods on an object to be called as though the object is an array.         
  • Accessed through an index.
  • Must be an instance member.
  • A get accessor of an indexer has the same formal parameter list as the indexer.
  • A set accessor of an indexer has the same formal parameter list as the indexer, in addition to the valueparameter.

No comments:

Post a Comment