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
Whats an assembly? Describe the importance of assembly?
How to implement a singleton design pattern in c#?
What are the principles of delegation?
How do you prevent a class from being inherited in c#?
What is a method signature in c#?
Why we use extension methods in c#?
What is icomparable in c#?
Is int reference type c#?
what are the contents of an assembly ?
What is bitwise operator in c#?
What is the difference between c and c# programming?
Will the following code compile and run?
What is the difference between delegates and events in c#?
What is lazy class in c#?
Explain About Postback