public class MyClass
{
public string this[string someArg]
{
get { return "You called this with " + someArg; }
}
}
class Program
{
void Main()
{
MyClass x = new MyClass();
Console.WriteLine(x["something"]);
}
}
Reference:
http://stackoverflow.com/questions/12391745/does-c-sharp-have-array-with-index-is-a-string-like-php
No comments:
Post a Comment