1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29
using System; interface IFoo <T> { T this [int index] { get; set; } } public class FooCollection <T> : IFoo <T> { T IFoo<T>.this [int index] { get { return default(T); } set { } } } class X { public static void Main () { IFoo<int> foo = new FooCollection<int> (); int a = foo [3]; Console.WriteLine (a); } }