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";Console.WriteLine(me["test"]);
}}
Monday, 12 January 2009
C# overloading index operator
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment