本文整理汇总了C#中CallInfo.GetHashCode方法的典型用法代码示例。如果您正苦于以下问题:C# CallInfo.GetHashCode方法的具体用法?C# CallInfo.GetHashCode怎么用?C# CallInfo.GetHashCode使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CallInfo
的用法示例。
在下文中一共展示了CallInfo.GetHashCode方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: HashCodeBasedOnEquality
public void HashCodeBasedOnEquality()
{
string[] names = new[] {"foo", "bar", "baz", "quux", "quuux"};
for (int i = 0; i <= names.Length; ++i)
{
for (int j = 0; j != 3; ++j)
{
for (int x = 0; x <= names.Length; ++x)
{
for (int y = 0; y != 3; ++y)
{
var info0 = new CallInfo(i + j, names.Take(i));
var info1 = new CallInfo(x + y, names.Take(x));
if (info0.Equals(info1))
{
Assert.Equal(info0.GetHashCode(), info1.GetHashCode());
}
else
{
// Failure at this point is not definitely a bug,
// but should be considered a concern unless it can be
// convincingly ruled a fluke.
Assert.NotEqual(info0.GetHashCode(), info1.GetHashCode());
}
}
}
}
}
}