C# overloading index operator

class MyClass
  private readonly Dictionary<string,object> data = new Dictionary<string,object>();
  public object this [string index]
    set{ data[index] = value; }
    get{ return data[index]; }
  public static void Main()
    MyClass me = new MyClass();
    me["test"] = "sample value";


Popular posts from this blog

Parse XML to dynamic object in C#

Parse XML to object model in C# using XSD utility