本文整理汇总了C#中net.named_data.jndn.Name.GetHashCode方法的典型用法代码示例。如果您正苦于以下问题:C# Name.GetHashCode方法的具体用法?C# Name.GetHashCode怎么用?C# Name.GetHashCode使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类net.named_data.jndn.Name
的用法示例。
在下文中一共展示了Name.GetHashCode方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: testHashCode
public void testHashCode()
{
Name foo1 = new Name("/ndn/foo");
Name foo2 = new Name("/ndn/foo");
Assert.AssertEquals("Hash codes for same Name value are not equal",
foo1.GetHashCode(), foo2.GetHashCode());
Name bar1 = new Name("/ndn/bar");
// Strictly speaking, it is possible for a hash collision, but unlikely.
Assert.AssertTrue("Hash codes for different Name values are not different",
foo1.GetHashCode() != bar1.GetHashCode());
Name bar2 = new Name("/ndn");
int beforeHashCode = bar2.GetHashCode();
bar2.append("bar");
Assert.AssertTrue("Hash code did not change when changing the Name object",
beforeHashCode != bar2.GetHashCode());
Assert.AssertEquals(
"Hash codes for same Name value after changes are not equal",
bar1.GetHashCode(), bar2.GetHashCode());
}