interface ITable {
// an indexer can be declared in an interface
object this[int x, int y] { get; set; }
}
class DataTable : ITable
{
private object[,] cells = new object[10, 10];
/// <summary>
/// implementation of the indexer declared in the interface
/// </summary>
/// <param name="x">X-Index</param>
/// <param name="y">Y-Index</param>
/// <returns>Content of this cell</returns>
public object this[int x, int y]
{
get
{
return cells[x, y];
}
set
{
cells[x, y] = value;
}
}
}