Essential C# Indexer  Suggest an edit

Indexer with 2 arguments and interface

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;
        }
    }
}


Table Of Contents
22 Enum
25 GUID
105 Indexer
107 Stream
108 Timers
  ↑ ↓ to navigate     ↵ to select     Esc to close