【发布时间】:2015-06-01 10:39:55
【问题描述】:
我有字典,其中值重复。如何防止字典中的重复?以下是我的代码
private class GcellGtrx
{
public Gcell Gcell { get; set; }
public Gtrx Gtrx { get; set; }
}
private readonly Dictionary<int, GcellGtrx> _dictionary = new Dictionary<int, GcellGtrx>();
_dictionary.Add(gcell.CellId, gcellGtrx);
【问题讨论】:
-
CellId是否应该包含重复项? -
Yuval Itzchakov 不是独一无二的
-
那怎么可能有重复的键呢?你实际上是如何调用你的代码的?
-
他说 values 是重复的,而不是键。