Commit 110b0a18 authored by 潘栩锋's avatar 潘栩锋 🚴

添加 RangeStruct 的比较器

parent 0d29afc4
......@@ -341,7 +341,44 @@ namespace Misc
}
/// <summary>
/// Range 比较器
/// </summary>
public class RangeStructEqualityComparer : IEqualityComparer<RangeStruct>
{
/// <summary>
///
/// </summary>
/// <param name="x"></param>
/// <param name="y"></param>
/// <returns></returns>
public bool Equals(RangeStruct x, RangeStruct y)
{
if ((x.Begin == y.Begin) && (x.End == y.End))
{
return true;
}
else
return false;
}
/// <summary>
///
/// </summary>
/// <param name="obj"></param>
/// <returns></returns>
public int GetHashCode(RangeStruct obj)
{
int hashCode = obj.Begin.GetHashCode();
int hashCode2 = obj.End.GetHashCode();
if (hashCode != hashCode2)
{
hashCode ^= hashCode2;
}
return hashCode;
}
}
/// <summary>
/// Range 辅助类
/// </summary>
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment