本文整理汇总了C#中Range.GetHashCode方法的典型用法代码示例。如果您正苦于以下问题:C# Range.GetHashCode方法的具体用法?C# Range.GetHashCode怎么用?C# Range.GetHashCode使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Range
的用法示例。
在下文中一共展示了Range.GetHashCode方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: CheckHashCode
public void CheckHashCode()
{
var rangeA = new Range<int>(1, 1);
var rangeB = new Range<int>(1, 2);
var rangeC = new Range<int>(1, 1);
Assert.IsFalse(rangeA.GetHashCode() == rangeB.GetHashCode());
Assert.IsTrue(rangeA.GetHashCode() == rangeC.GetHashCode());
}
示例2: GetHashCode_WorksAsExpected
public void GetHashCode_WorksAsExpected(int xiMin1, int xiMax1, int xiMin2, int xiMax2)
{
var firstRange = new Range(xiMin1, xiMax1);
var secondRange = new Range(xiMin2, xiMax2);
Assert.AreNotEqual(firstRange.GetHashCode(), secondRange.GetHashCode());
}
示例3: GetHashCodeTest
public void GetHashCodeTest()
{
var a = new Range<int>(1, 3);
var b = new Range<int>(1, 3);
Assert.AreEqual(a.GetHashCode(), b.GetHashCode());
a = new Range<int>(1);
b = new Range<int>(1);
Assert.AreEqual(a.GetHashCode(), b.GetHashCode());
a = new Range<int>(null, 1);
b = new Range<int>(null, 1);
Assert.AreEqual(a.GetHashCode(), b.GetHashCode());
a = new Range<int>(null);
b = new Range<int>(null);
Assert.AreEqual(a.GetHashCode(), b.GetHashCode());
}