C# iterator with string key
I wish t开发者_运维百科o write a class similar to the dictionary class where I can add the text value of an object and return the object.
I was wondering if there is a simple way to do this in C# 3.5 without having a dictionary object inside my class (without using the dictionary class).
Thanks in advance,
Do you mean a string indexer?
class Foo
{
public object this[string key]
{
get
{
// Get the value.
}
set
{
// Set the value.
}
}
}
精彩评论