Asp.net programming we consider all important topic for knowledge about controls,web Services, JSON, Ajax, database, and interview related Question. In this Asp.net and sql server tutorial blog we give many examples of jquery as like How Play YouTube Video in Your Asp.net Website by URL, How to Play YouTube Videos in Asp.net by using Jquery , Jquery Change div background on mouseover in asp.net , JQuery UI Datepicker (Calendar) etc.

Saturday, August 22, 2015

Asp.net C#: what is an indexer in C# how to use indexers?

Asp.net C#: what is an indexer in C# how to use indexers?

An Indexer in C#:

C# provides a new functionality called indexers which are use for treating as an object of array. The indexers are usually known as smart array in C#. Defining an indexer is much like defining a property.






So we can say that the indexer is a member that enables an object to be indexed in the same way as an array.

Syntax of indexer in C#:

<Modifier><return type> this [argument list]
{
Get
{
// get codes goes here
}
Set
{
// set codes goes here
}
}

Where modifier can be private, public or protected etc.

And ‘this’ is this is a special keyword in C# to indicate the object of current class.

1 comment:

  1. Wow! Nice post. After reading this blog, I got some information about indexer and how to use this in Asp.net C#. I have a little bit knowledge about Running ASP.NET 5 applications in Linux Containers. When I hosted my website I got this idea from there. Thanks a lot for sharing this nice info.

    ReplyDelete