本文整理汇总了C#中TypeUsage.EdmEquals方法的典型用法代码示例。如果您正苦于以下问题:C# TypeUsage.EdmEquals方法的具体用法?C# TypeUsage.EdmEquals怎么用?C# TypeUsage.EdmEquals使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类TypeUsage
的用法示例。
在下文中一共展示了TypeUsage.EdmEquals方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: TryGetCommonType
/// <summary>
/// Determines if a common super type (LUB) exists between type1 and type2.
/// </summary>
/// <param name="type1"></param>
/// <param name="type2"></param>
/// <param name="commonType"></param>
/// <returns>
/// true if a common super type between type1 and type2 exists and out commonType represents the common super type.
/// false otherwise along with commonType as null
/// </returns>
internal static bool TryGetCommonType(TypeUsage type1, TypeUsage type2, out TypeUsage commonType)
{
Debug.Assert(type1 != null, "type1 must not be NULL");
Debug.Assert(type2 != null, "type2 must not be NULL");
commonType = null;
if (type1.EdmEquals(type2))
{
commonType = ForgetConstraints(type2);
return true;
}
if (Helper.IsPrimitiveType(type1.EdmType) && Helper.IsPrimitiveType(type2.EdmType))
{
return TryGetCommonPrimitiveType(type1, type2, out commonType);
}
EdmType commonEdmType;
if (TryGetCommonType(type1.EdmType, type2.EdmType, out commonEdmType))
{
commonType = ForgetConstraints(TypeUsage.Create(commonEdmType));
return true;
}
commonType = null;
return false;
}
示例2: IsSubTypeOf
/// <summary>
/// determines if subType is equal to or a sub-type of superType.
/// </summary>
/// <param name="subType"> </param>
/// <param name="superType"> </param>
/// <returns> true if subType is equal to or a sub-type of superType, false otherwise </returns>
internal static bool IsSubTypeOf(TypeUsage subType, TypeUsage superType)
{
DebugCheck.NotNull(subType);
DebugCheck.NotNull(superType);
if (subType.EdmEquals(superType))
{
return true;
}
if (Helper.IsPrimitiveType(subType.EdmType)
&& Helper.IsPrimitiveType(superType.EdmType))
{
return IsPrimitiveTypeSubTypeOf(subType, superType);
}
return subType.IsSubtypeOf(superType);
}
示例3: IsSubTypeOf
/// <summary>
/// determines if subType is equal to or a sub-type of superType.
/// </summary>
/// <param name="subType"></param>
/// <param name="superType"></param>
/// <returns>true if subType is equal to or a sub-type of superType, false otherwise</returns>
internal static bool IsSubTypeOf(TypeUsage subType, TypeUsage superType)
{
Debug.Assert(subType != null, "subType must not be NULL");
Debug.Assert(superType != null, "superType must not be NULL");
if (subType.EdmEquals(superType))
{
return true;
}
if (Helper.IsPrimitiveType(subType.EdmType) && Helper.IsPrimitiveType(superType.EdmType))
{
return IsPrimitiveTypeSubTypeOf(subType, superType);
}
return subType.IsSubtypeOf(superType);
}
示例4: TryGetCommonType
/// <summary>
/// Determines if a common super type (LUB) exists between type1 and type2.
/// </summary>
/// <param name="type1"> </param>
/// <param name="type2"> </param>
/// <param name="commonType"> </param>
/// <returns> true if a common super type between type1 and type2 exists and out commonType represents the common super type. false otherwise along with commonType as null </returns>
internal static bool TryGetCommonType(TypeUsage type1, TypeUsage type2, out TypeUsage commonType)
{
DebugCheck.NotNull(type1);
DebugCheck.NotNull(type2);
commonType = null;
if (type1.EdmEquals(type2))
{
commonType = ForgetConstraints(type2);
return true;
}
if (Helper.IsPrimitiveType(type1.EdmType)
&& Helper.IsPrimitiveType(type2.EdmType))
{
return TryGetCommonPrimitiveType(type1, type2, out commonType);
}
EdmType commonEdmType;
if (TryGetCommonType(type1.EdmType, type2.EdmType, out commonEdmType))
{
commonType = ForgetConstraints(TypeUsage.Create(commonEdmType));
return true;
}
commonType = null;
return false;
}