【发布时间】:2011-11-09 21:47:10
【问题描述】:
我有一个存储在列表中的对象集合。
我想使用字符串名称而不是整数来寻址对象。
List<Foo> fooList = new List<Foo>;
Foo item = fooList["Foo Name"]
代替:
List<Foo> fooList = new List<Foo>;
Foo item = fooList[0]
我在想我需要创建一个从 List 继承的集合类,但我不确定。
【问题讨论】:
-
词典呢?
标签: c# list collections