Try this:
public class MyClassA
{
public int Id { get; set; }
public string UserInfo { get; set; }
public decimal count { get; set; }
public override int GetHashCode( )
{
return HashCode.Combine( Id, UserInfo, count );
}
}
// or this:
public struct MyStructA
{
public int Id { get; set; }
public string UserInfo { get; set; }
public decimal count { get; set; }
// Use the default 'GetHashCode()'. The hash code is calculated by .NET.
}
The documentation recommends to override the Equals(object) function too.
By the way, if two objects are not equal, the hash codes are not always different. GetHashCode is not enough to find the duplicates.