// Collection of code snippets by Arne Vajhøj // (likely posted to comp.os.vms/INFO-VAX, INFO-TPU, MACRO32, eksperten.dk, newz.dk, LinkedIn or other place sometime between 1990 and now) using System; namespace E { public interface IList { T this[int ix] { get; } } public interface IList { object this[int ix] { get; } } public class MyList : IList, IList where T : class { public T this[int ix] { get { Console.WriteLine("IList.Item"); return null; } } object IList.this[int ix] { get { Console.WriteLine("IList.Item"); return null; } } } public class Program { public static void Main(string[] args) { object dummy; IList o1 = new MyList(); dummy = o1[0]; IList o2 = new MyList(); dummy = o2[0]; MyList o3 = new MyList(); dummy = o3[0]; } } }