JAVA中向集合中添加重复的键可以用Map,那么C#呢????????????????
csharp中有字典,不过键值是唯一的
可以的,使用List
public class userEntity
{
public int keys { get; set; }
public string values { get; set; }
}
List<userEntity> list = new List<userEntity>();
字典或者hashtable
C#用List<KeyBaluePair<T1, Y2>>
T1 T2是你键和值的类型
不可以添加重复的键。
审视下自己的数据结构。
或者嵌套
Dictionary> dic = new Dictionary>();
Dictionary> dicList = new Dictionary>();
LookUp 类,可以通过 Enumerable.ToLookup 函数获取该类的实例,你看看能不能满足你的需求。