I am unable to remove the duplicates from collection , i have implemented IEqualityComparer for the class Employee still i am not getting the output
static v
Also it looks like your comparing by reference instead of content, hence the compare function doesn't work.
change it to use .Equals() instead of == and it should work. example below:
#region IEqualityComparer Members
public bool Equals(Employe x, Employe y)
{
if (x.fName.Equals(y.fName) && x.lName.Equals(y.lName))
{
return true;
}
return false;
}
public int GetHashCode(Employe obj)
{
return obj.GetHashCode();
}
#endregion