.NET Tutorials, Forums, Interview Questions And Answers
Welcome :Guest
 
Sign In
Register
 
Win Surprise Gifts!!!
Congratulations!!!


Top 5 Contributors of the Month
david stephan

Home >> Interview Question >> .NET Framework >> Post New Question Subscribe to Interview Questions

What are Indexers

Posted By :Karthikeyan Anbarasan     Posted Date :June 28, 2011    Points :40   Category :.NET Framework 
Indexers permit instances of a class or struct to be indexed in the same way as arrays.

· Indexers are similar to properties except that their accessors take parameters.

· The indexers are usually known as smart arrays in C#.

· An indexer, also called an indexed property, is a class property that allows you to access a member variable of a class using the features of an array.

· Defining an indexer allows you to create classes that act like virtual arrays. Instances of that class can be accessed using the [] array access operator.




You can also find related Interview Question to What are Indexers  below: 

What are Indexers

  
Indexers permit instances of a class or struct to be indexed in the same way as arrays.

· Indexers are similar to properties except that their accessors take parameters.

· The indexers are usually known as smart arrays in C#.

· An indexer, also called an indexed property, is a class property that allows you to access a member variable of a class using the features of an array.

· Defining an indexer allows you to create classes that act like virtual arrays. Instances of that class can be accessed using the [] array access operator.


(More...)

What are the Important points to remember on indexers

  
Indexers are always created with this keyword.

· Parameterized property are called indexer.

· Indexers are implemented through get and set accessors for the [ ] operator.

· ref and out parameter modifiers are not permitted in indexer.

· Indexer is an instance member so can't be static but property can be static.

· Indexers are used on group of elements.

· Indexer can be overloaded.
(More...)

Difference between Indexers and Properties

  
Indexers are created with this keyword
Properties don't require this keyword

Indexers are identified by signature
Properties are identified by their names

Indexers are accessed using indexes
Properties are accessed by their names

Indexer are instance member, so can't be static
Properties can be static as well as instance members

(More...)

Quick Links For Interview Questions Categories:
ASP.Net Windows Application   .NET Framework   C#   VB.Net   ADO.Net  
Sql Server   SharePoint   Silverlight   OOPs   JQuery   JavaScript/VBScript
Biztalk Patten/Practices .IIS WCF WPF WWF
Networking Aptitude Others   All      

Find questions, FAQ's and their answers related to .NET, C#, Vb.Net, Sql Server and many more.

 
Now you can find lots of .NET, C#, Vb.Net, SQL Server,Windows, ASP.Net related Questions and their Answers here at www.dotnetspark.com. Our aim is to help you pass your certification Exams (MCP, MCSD, MCAD etc.,) with flying scores and get good name in your company.

So, Start looking our Interview Question section daily and improve your .NET Skills. You can also help others by posting Interview Questions and their Answers in this section.


Hall of Fame    Twitter   Terms of Service    Privacy Policy    Contact Us    Archives   Tell A Friend