本文整理汇总了C#中IEdmElement.GetHashCode方法的典型用法代码示例。如果您正苦于以下问题:C# IEdmElement.GetHashCode方法的具体用法?C# IEdmElement.GetHashCode怎么用?C# IEdmElement.GetHashCode使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类IEdmElement
的用法示例。
在下文中一共展示了IEdmElement.GetHashCode方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: CompareElements
private int CompareElements(IEdmElement left, IEdmElement right)
{
if (left == right)
{
return 0;
}
/* Left and right are distinct. */
int leftHash = left.GetHashCode();
int rightHash = right.GetHashCode();
if (leftHash < rightHash)
{
return -1;
}
if (leftHash > rightHash)
{
return 1;
}
/* Left and right are distinct and have identical hash codes. */
IEdmNamedElement leftNamed = left as IEdmNamedElement;
IEdmNamedElement rightNamed = right as IEdmNamedElement;
if (leftNamed == null)
{
if (rightNamed != null)
{
return -1;
}
}
else if (rightNamed == null)
{
return 1;
}
else
{
/* Left and right are both named. */
int nameComparison = string.Compare(leftNamed.Name, rightNamed.Name, StringComparison.Ordinal);
if (nameComparison != 0)
{
return nameComparison;
}
}
/* Left and right are distinct, have identical hash codes, and have identical names. */
/* The first element to occur in the unsorted list is the greatest. */
while (true)
{
foreach (IEdmElement element in this.unsortedElements)
{
if (element == left)
{
return 1;
}
if (element == right)
{
return -1;
}
}
lock (this.unsortedElementsLock)
{
this.unsortedElements = this.unsortedElements.Add(left);
}
}
}
示例2: CompareElements
private int CompareElements(IEdmElement left, IEdmElement right)
{
int num;
if (left != right)
{
int hashCode = left.GetHashCode();
int hashCode1 = right.GetHashCode();
if (hashCode >= hashCode1)
{
if (hashCode <= hashCode1)
{
IEdmNamedElement edmNamedElement = left as IEdmNamedElement;
IEdmNamedElement edmNamedElement1 = right as IEdmNamedElement;
if (edmNamedElement != null)
{
if (edmNamedElement1 != null)
{
int num1 = string.Compare(edmNamedElement.Name, edmNamedElement1.Name, StringComparison.Ordinal);
if (num1 != 0)
{
return num1;
}
}
else
{
return 1;
}
}
else
{
if (edmNamedElement1 != null)
{
return -1;
}
}
while (true)
{
foreach (IEdmElement unsortedElement in this.unsortedElements)
{
if (unsortedElement != left)
{
if (unsortedElement != right)
{
continue;
}
num = -1;
return num;
}
else
{
num = 1;
return num;
}
}
lock (this.unsortedElementsLock)
{
this.unsortedElements = this.unsortedElements.Add(left);
}
}
return num;
}
else
{
return 1;
}
}
else
{
return -1;
}
}
else
{
return 0;
}
}