fork download
  1. using System;
  2. using System.Collections.Generic;
  3.  
  4. public class Test
  5. {
  6. static void Main(string[] args)
  7. {
  8. var set = new HashSet<MyClass>
  9. {
  10. new MyClass { Value = 1 },
  11. new MyClass { Value = 2 }
  12. };
  13. foreach (var x in set)
  14. Console.WriteLine(x.Value);
  15. }
  16. }
  17.  
  18. class MyClass
  19. {
  20. public int Value { get; set; }
  21. public override int GetHashCode() => 0;
  22. }
Success #stdin #stdout 0s 131520KB
stdin
Standard input is empty
stdout
1
2