fork download
using System;

class Program
{
    static void Main(string[] args)
    {
        MyArray fruit = new MyArray(-2, 1);
        fruit[-2] = "Apple";
        fruit[-1] = "Orange";
        fruit[0] = "Banana";
        fruit[1] = "Blackcurrant";
        Console.WriteLine(fruit[-1]);       // Outputs "Orange"
        Console.WriteLine(fruit[0]);        // Outputs "Banana"
        Console.WriteLine(fruit[-1,0]);     // Output "O"
    }
}

class MyArray
{
    int _lowerBound;
    int _upperBound;
    string[] _items;

    public MyArray(int lowerBound, int upperBound)
    {
        _lowerBound = lowerBound;
        _upperBound = upperBound;
        _items = new string[1 + upperBound - lowerBound];
    }

    public string this[int index]
    {
        get { return _items[index - _lowerBound]; }
        set { _items[index - _lowerBound] = value; }

    }

    public string this[int word, int position]
    {
        get { return this[word].Substring(position, 1); }
    }
}
Success #stdin #stdout 0.03s 36856KB
stdin
Standard input is empty
stdout
Orange
Banana
O