Indexer Vs Property


Recently I gone threw the Technical Interview in Accenture. In My Tech Round they have asked me

“What is Indexer?”

I was not able to answer the question because i never used it in any of my project as well not read anywhere about it.

Luckily I am selected also. Sooner will get appointment letter if i get what i want. (HR Round)

So I goggled on it & find out what is indexer. now Here I am looking to share it with you so that at least you can answer.

Indexer Property
Identified by its signature. Identified by its name.
Accessed through an element access. Accessed through a simple name or a member access.
Must be an instance member. Can be a static or an instance member.
A get accessor of an indexer has the same formal parameter list as the indexer. A get accessor of a property has no parameters.
A set accessor of an indexer has the same formal parameter list as the indexer, in addition to the value parameter. A set accessor of a property contains the implicit value parameter.

Hope this will help

Reference  : http://msdn.microsoft.com/en-us/library/6x16t2tx%28VS.71%29.aspx

Advertisements

One thought on “Indexer Vs Property

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s