What are the valid parameter types we can pass in an
Indexer ?

Answer Posted / guest

Hi,
This is Madhu from HYD..............

Indexer is same as property procedure.It provides array like
accessing.

Indexers are used to access the array of elements with
respect to object name. The name of Indexers always this.
Indexer can't be static.

EX:---
Public class demoindexer
{
int []a={10,20,30,40};
public int this[int index]
{
get
{
return a[index];
}
set
{
a[index]=value;
}
}
public static void main()
{
demo obj1;
obj1=new demo();
obj1.[0]--->10;
obj1.[1]--->20;
obj1.[2]--->30;
obj1.[3]--->40;
}
}

Is This Answer Correct ?    7 Yes 2 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

What is a cshtml file?

536


Is unboxing an implicit conversion?

540


Is system a class in c#?

496


Why do we use namespace in c#?

523


What is an indexer in c#?

546






Is c++ or c# better?

542


Can a struct inherit from another struct or class in c#?

521


What is literal in c#?

473


Which function is the entry point for a DLL in MS Windows 3.1?

681


Are string objects mutable or immutable?

531


Why do we use Design Pattern in C#?

576


When do we generally use destructors to release resources?

523


Explain what is an interface in c#?

521


Explain jagged arrays in c#?

576


Can bool be null c#?

499