【发布时间】:2011-05-19 15:06:04
【问题描述】:
有没有一种简单的方法来计算特定字典键值的值?
static void Main()
{
Dictionary<string, ArrayList> SpecTimes = new Dictionary<string, ArrayList>;
ArrayList times = new ArrayList();
string count = "";
times.Add = "000.00.00";
times.Add = "000.00.00";
times.Add = "000.00.00";
string spec = "A101";
SpecTimes.Add(spec,times);
count = SpecTimes[spec].values.count;
}
【问题讨论】:
-
这看起来像一半 C# 一半......我不知道。
-
不要使用
ArrayLists。相反,使用List<T> -
为什么要混合泛型集合和非泛型集合?并且不在您的方法调用中使用方括号?请出示真实代码。
标签: c# dictionary arraylist