本文整理汇总了C#中ItemId.GetHashCode方法的典型用法代码示例。如果您正苦于以下问题:C# ItemId.GetHashCode方法的具体用法?C# ItemId.GetHashCode怎么用?C# ItemId.GetHashCode使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ItemId
的用法示例。
在下文中一共展示了ItemId.GetHashCode方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: ItemIdEquality
public void ItemIdEquality()
{
Guid id0 = Guid.NewGuid();
var ii0 = new ItemId(typeof(HeaderContent), id0);
var ii1 = new ItemId(typeof(HeaderContent), new Guid(id0.ToString()));
var ii2 = new ItemId(typeof(RestaurantContent), id0);
var ii3 = new ItemId(typeof(HeaderContent), Guid.NewGuid());
Assert.IsTrue(ii0.Equals(ii1), ".Equals true");
Assert.IsTrue(ii0 == ii1, "== true");
Assert.IsFalse(ii0.Equals(ii2), ".Equals false by type");
Assert.IsFalse(ii0 == ii2, "== false by type");
Assert.IsFalse(ii1.Equals(ii3), ".Equals false by id");
Assert.IsFalse(ii1 == ii3, "== false by id");
Assert.IsFalse(ii0.GetHashCode() == ii2.GetHashCode(), "hash code by type");
Assert.IsFalse(ii1.GetHashCode() == ii3.GetHashCode(), "hash code by id");
}