【发布时间】:2012-02-02 12:21:11
【问题描述】:
我想创建一个这样的列表:
List<int, DateTime> foo = new List<int, DateTime>();
但我收到此错误:
Using the generic type 'System.Collections.Generic.List<T>' requires 1 type arguments
在 C# 中可以做到这一点吗?
【问题讨论】:
-
这没有任何意义。你需要一门课。
-
List<T>只能是 one 类型。你想创建一个Dictionary<TKey, TValue>吗? -
在java中可以使用HashMap
-
不是字典,我想给每个 DateTime 一个 ID。
-
@OpenMind: stackoverflow.com/questions/1273139/…