Created
May 13, 2014 15:00
-
-
Save jdowd7/59162b80fe6951029f3d to your computer and use it in GitHub Desktop.
Just a generic class for comparison: C#, generic object, IEqualityComparer<generic>, multiple attribute object, hashcode of object
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class genericObjectCompareClass : IEqualityComparer<objectType> | |
{ | |
#region IEqualityComparer<objectType> Members | |
public bool Equals(Object1 x, Object2 y) | |
{ | |
return x.Attribute1.Equals(y.Attribute1); | |
} | |
public int GetHashCode(vipFlip obj) | |
{ | |
return obj.Attribute1.GetHashCode(); | |
} | |
#endregion | |
} | |
//Source: http://www.codeproject.com/Articles/94272/A-Generic-IEqualityComparer-for-Linq-Distinct | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment