本文整理汇总了C#中IType.IsSame方法的典型用法代码示例。如果您正苦于以下问题:C# IType.IsSame方法的具体用法?C# IType.IsSame怎么用?C# IType.IsSame使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类IType
的用法示例。
在下文中一共展示了IType.IsSame方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: NeedsInserting
public override bool NeedsInserting(object entry, int i, IType elemType)
{
IList sn = (IList) GetSnapshot();
EntityMode entityMode = Session.EntityMode;
if (sn.Count > i && elemType.IsSame(sn[i], entry, entityMode))
{
// a shortcut if its location didn't change
return false;
}
else
{
//search for it
foreach (object old in sn)
{
if (elemType.IsEqual(old, entry, entityMode))
{
return false;
}
}
return true;
}
}
示例2: CountOccurrences
/// <summary>
/// Counts the number of times that the <paramref name="element"/> occurs
/// in the <paramref name="list"/>.
/// </summary>
/// <param name="element">The element to find in the list.</param>
/// <param name="list">The <see cref="IList"/> to search.</param>
/// <param name="elementType">The <see cref="IType"/> that can determine equality.</param>
/// <param name="entityMode">The entity mode.</param>
/// <returns>
/// The number of occurrences of the element in the list.
/// </returns>
private static int CountOccurrences(object element, IList list, IType elementType, EntityMode entityMode)
{
int result = 0;
foreach (object obj in list)
{
if (elementType.IsSame(element, obj, entityMode))
{
result++;
}
}
return result;
}