INDEXERS

The indexers used to provide array like process to class. The indexer act like a virtual array. By this indexer we can manage the value any way we want.

Example:

using System;

using System.Collections;

namespace namespace1

{

class class1

{

private string[] data=new string[5];

public string this[int index];

{

get

{

return date[index];

}

set

{

data[index]=value;

}

}

}

class MyClient

{

public static void Main()

{

class1 c=new class1();

c[2]="h";

c[3]="a";

c[4]="i";

}

}

}