C# SortedSet<T> and equality
问题 I am a bit puzzled about the behaviour of SortedSet, see following example: public class Blah { public double Value { get; private set; } public Blah(double value) { Value = value; } } public class BlahComparer : Comparer<Blah> { public override int Compare(Blah x, Blah y) { return Comparer<double>.Default.Compare(x.Value, y.Value); } } public static void main() { var blahs = new List<Blah> {new Blah(1), new Blah(2), new Blah(3), new Blah(2)} //contains all 4 entries var set = new HashSet