标签:uuid bool pac lse code space 条件 ace ali
自定义两对象是否相等方法,必须用到GetHashCode方法,如
public class AirspaceCompareByUUID : IEqualityComparer<AIRSPACE_TS>
{
public bool Equals(AIRSPACE_TS x, AIRSPACE_TS y)
{
if (x == null || y == null)
return false;
if (x.AIRSPACE_UUID == y.AIRSPACE_UUID)
return true;
else
return false;
}
public int GetHashCode(AIRSPACE_TS obj)
{
if (obj == null)
return 0;
else
return obj.AIRSPACE_UUID.GetHashCode();
}
}
标签:uuid bool pac lse code space 条件 ace ali
原文地址:https://www.cnblogs.com/mol1995/p/9160556.html