Golgappa.net | Golgappa.org | BagIndia.net | BodyIndia.Com | CabIndia.net | CarsBikes.net | CarsBikes.org | CashIndia.net | ConsumerIndia.net | CookingIndia.net | DataIndia.net | DealIndia.net | EmailIndia.net | FirstTablet.com | FirstTourist.com | ForsaleIndia.net | IndiaBody.Com | IndiaCab.net | IndiaCash.net | IndiaModel.net | KidForum.net | OfficeIndia.net | PaysIndia.com | RestaurantIndia.net | RestaurantsIndia.net | SaleForum.net | SellForum.net | SoldIndia.com | StarIndia.net | TomatoCab.com | TomatoCabs.com | TownIndia.com
Interested to Buy Any Domain ? << Click Here >> for more details...

Indexers in c#?

Answer Posted / srinivasu

1.Indexer is a concept of using an object like an array.
2.indexers are similar to properties
3.Indexer is a collection of SET and GET methods.
4.Indexer name must be "this".
5.One class can have only one indexer.

syntax:
------

properties:
-----------
string s;
public string Pname
{
set { s=value;}

get { return s;}
}


Indexers:(example)
---------

class test
{
string [] x=new string[3];
public string this [int i]
{
set {x[i]=value;}

get {return x[i];}

}

public void print()
{
for(int i=0;i<x.lenght;i++)
messageBox.show(x[i]);

}

}
//using

test t=new test();
t[0]="vasu";
t[1]="liki";
t[2]="kavi";
t.print();

Is This Answer Correct ?    16 Yes 11 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

How many parameters can a method have c#?

929


What are some examples of desktop applications?

928


What is command object in c#?

949


What is the difference between c and c# programming?

950


Explain dataadapter.update method in .net?

968


Does c# support multiple class inheritance?

1106


What is the difference between “dispose” and “finalize” variables in c#?

1011


How do you set a class path?

875


What is data types in c#?

950


Can you access a hidden base class method in the derived class?

918


Can we customize the serialization process?

955


Explain metadata in c#.

892


Why do I get a "cs5001: does not have an entry point defined" error when compiling?

994


Is typeof c#?

997


Explain concurrency with aop?

981