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
What is a cshtml file?
Is unboxing an implicit conversion?
Is system a class in c#?
Why do we use namespace in c#?
What is an indexer in c#?
Is c++ or c# better?
Can a struct inherit from another struct or class in c#?
What is literal in c#?
Which function is the entry point for a DLL in MS Windows 3.1?
Are string objects mutable or immutable?
Why do we use Design Pattern in C#?
When do we generally use destructors to release resources?
Explain what is an interface in c#?
Explain jagged arrays in c#?
Can bool be null c#?