I must get GetHashCode from object, not from PropertyType
public class SomeClass
{
public decimal ClientCode { get; set; }
public DateTime Date { get; set; }
public string Name { get; set; }
public int Age { get; set; }
public byte B { get; set; }
public override int GetHashCode()
{
int sum = 0;
foreach (var p in GetType().GetProperties())
{
var method = typeof(object).GetMethod("GetHashCode");
var value = p.GetValue(this, null);
if (value != null)
sum += (int)(method.Invoke(value, null));
}
return sum;
}
}