in C Sharp by
Q:
Explain Indexers in C#?

1 Answer

0 votes
by
Indexers are used for allowing the classes to be indexed like arrays. Indexers will resemble the property structure but only difference is indexer’s accessors will take parameters. For example,

class MyCollection<T>

{

 private T[] myArr = new T[100];

 public T this[int t]

 {

 get

 {

 return myArr[t];

 }

 set

 {

 myArr[t] = value;

 }

 }

}
Click here to read more about Loan/Mortgage
Click here to read more about Insurance

Related questions

+1 vote
0 votes
asked Oct 18, 2019 in C Sharp by Robin
0 votes
asked Oct 18, 2019 in C Sharp by Robin
0 votes
0 votes
asked Oct 18, 2019 in C Sharp by Robin
0 votes
asked Feb 18, 2020 in C Sharp by rahuljain1
0 votes
asked Jun 16, 2020 in C Sharp by Hodge
...