Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR CSHARP

c# dictionary contain key but returns false

class KeyComparer : IEqualityComparer<Key>
{
    public bool Equals(Key x, Key y)
    {
        return x.Name == y.Name;
    }

    public int GetHashCode(Key obj)
    {
        return obj.Name.GetHashCode();
    }
}
Source by stackoverflow.com #
 
PREVIOUS NEXT
Tagged: #dictionary #key #returns #false
ADD COMMENT
Topic
Name
9+2 =