Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- class SomeClass : SomeInterface {
- public overwrite int GetHashCode() {
- return "SomeClass".GetHashCode();
- }
- }
- //Assume a == b, b == c, but a != c
- var T = new Dictionary<YourType, int>()
- T[a] = 0
- T[c] = 1
- return T[b] //0 or 1? who knows!
- //Assume a == b, b == c, but a != c
- var T = new HashSet<YourType>()
- T.Add(a)
- T.Add(c)
- if (T.contains(b)) then T.remove(b)
- //surely T can't contain b anymore! I sure hope no one breaks the properties of equality!
- if (T.contains(b)) then throw new Exception()
Add Comment
Please, Sign In to add comment