开发者

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.
        }
    }
}
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜