Skip to content

Instantly share code, notes, and snippets.

@jdowd7
Created May 13, 2014 15:00
Show Gist options
  • Save jdowd7/59162b80fe6951029f3d to your computer and use it in GitHub Desktop.
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
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