// 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; public class V1 { private string[] s = new string[2]; public string this[int index] { get { return s[index]; } set { s[index] = value; } } } public class V2 { private string[] s = new string[2]; public string[] S { get { return s; } set { s = value; } } } public class TestClass { public static void Main(string[] args) { V1 v1 = new V1(); v1[1] = "abc"; Console.WriteLine(v1[1]); V2 v2 = new V2(); v2.S[1] = "def"; Console.WriteLine(v2.S[1]); } }