本文整理汇总了C#中Union.GetHashCode方法的典型用法代码示例。如果您正苦于以下问题:C# Union.GetHashCode方法的具体用法?C# Union.GetHashCode怎么用?C# Union.GetHashCode使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Union
的用法示例。
在下文中一共展示了Union.GetHashCode方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: DifferentT1T3Values_AreNotEqualAndHaveDifferentHashCodes
public void DifferentT1T3Values_AreNotEqualAndHaveDifferentHashCodes()
{
var a = new Union<int, string, Colors>(0);
var b = new Union<int, string, Colors>(Colors.Green);
IsFalse(a.Equals(b));
IsTrue(a != b);
AreNotEqual(a.GetHashCode(), b.GetHashCode());
}
示例2: SameT3Values_AreEqualAndHaveSameHashCode
public void SameT3Values_AreEqualAndHaveSameHashCode()
{
var a = new Union<int, string, Colors>(Colors.Blue);
var b = new Union<int, string, Colors>(Colors.Blue);
IsTrue(a.Equals(b));
IsTrue(a == b);
AreEqual(a.GetHashCode(), b.GetHashCode());
}
示例3: DifferentValues_AreNotEqualAndHaveDifferentHashCodes
public void DifferentValues_AreNotEqualAndHaveDifferentHashCodes()
{
var a = new Union<int, string>(0);
var b = new Union<int, string>("1234");
IsFalse(a.Equals(b));
IsTrue(a != b);
AreNotEqual(a.GetHashCode(), b.GetHashCode());
}
示例4: SameT2Values_AreEqualAndHaveSameHashCode
public void SameT2Values_AreEqualAndHaveSameHashCode()
{
var a = new Union<int, string>("1234");
var b = new Union<int, string>("1234");
IsTrue(a.Equals(b));
IsTrue(a == b);
AreEqual(a.GetHashCode(), b.GetHashCode());
}
示例5: SameT4Values_AreEqualAndHaveSameHashCode
public void SameT4Values_AreEqualAndHaveSameHashCode()
{
var a = new Union<int, string, Colors, Animals>(Animals.Cat);
var b = new Union<int, string, Colors, Animals>(Animals.Cat);
IsTrue(a.Equals(b));
IsTrue(a == b);
AreEqual(a.GetHashCode(), b.GetHashCode());
}
示例6: DifferentT3T4Values_AreNotEqualAndHaveDifferentHashCodes
public void DifferentT3T4Values_AreNotEqualAndHaveDifferentHashCodes()
{
var a = new Union<int, string, Colors, Animals>(Colors.Red);
var b = new Union<int, string, Colors, Animals>(Animals.Cow);
IsFalse(a.Equals(b));
IsTrue(a != b);
AreNotEqual(a.GetHashCode(), b.GetHashCode());
}