Create a gist now

Instantly share code, notes, and snippets.

@kevingosse /hashset.cs Secret
Created Mar 26, 2017

What would you like to do?
var hashSet = new HashSet<SomeAttribute>();
typeof(SomeClass).GetCustomAttributes(false);//without this line, GetHashCode behaves as expected
SomeAttribute tt = new SomeAttribute();
hashSet.Add(tt);
Console.WriteLine(hashSet.Contains(tt)); // Will display false
hashSet.Add(tt);
Console.WriteLine(hashSet.Contains(tt)); // Will display true
Console.WriteLine(hashSet.Count); // Will display 2
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment