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
How do I edit a dll file?
Why do we need delegates?
What is a generic class?
Does c# have its own class library?
If casting fails what type of exception is thrown?
What is signature c#?
If you want to write your own dot net language, what steps you will u take care?
Is lazy thread safe c#?
What is asp net in c#?
What is CASPOL?
What are the generation of Garbage Collection in C# .NET ?
Can we store different data types in arraylist in c#?
What is iformatprovider in c#?
Is nullable type c#?
How many bytes is a char c#?