Guest User

Untitled

a guest
Jun 18th, 2018
87
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.50 KB | None | 0 0
  1. class SomeClass : SomeInterface {
  2. public overwrite int GetHashCode() {
  3. return "SomeClass".GetHashCode();
  4. }
  5. }
  6.  
  7. //Assume a == b, b == c, but a != c
  8. var T = new Dictionary<YourType, int>()
  9. T[a] = 0
  10. T[c] = 1
  11. return T[b] //0 or 1? who knows!
  12.  
  13. //Assume a == b, b == c, but a != c
  14. var T = new HashSet<YourType>()
  15. T.Add(a)
  16. T.Add(c)
  17. if (T.contains(b)) then T.remove(b)
  18. //surely T can't contain b anymore! I sure hope no one breaks the properties of equality!
  19. if (T.contains(b)) then throw new Exception()
Add Comment
Please, Sign In to add comment