本文整理汇总了C#中Internal.TypeSystem.DefType.IsWellKnownType方法的典型用法代码示例。如果您正苦于以下问题:C# DefType.IsWellKnownType方法的具体用法?C# DefType.IsWellKnownType怎么用?C# DefType.IsWellKnownType使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Internal.TypeSystem.DefType
的用法示例。
在下文中一共展示了DefType.IsWellKnownType方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: ComputeHomogeneousFloatAggregateElementType
public override DefType ComputeHomogeneousFloatAggregateElementType(DefType type)
{
if (!type.IsHfa)
return null;
if (type.IsWellKnownType(WellKnownType.Double) || type.IsWellKnownType(WellKnownType.Single))
return type;
for (;;)
{
Debug.Assert(type.IsValueType);
// All HFA fields have to be of the same HFA type, so we can just return the type of the first field
TypeDesc firstFieldType = null;
foreach (var field in type.GetFields())
{
if (field.IsStatic)
continue;
firstFieldType = field.FieldType;
break;
}
Debug.Assert(firstFieldType != null, "Why is IsHfa true on this type?");
switch (firstFieldType.Category)
{
case TypeFlags.Single:
case TypeFlags.Double:
return (DefType)firstFieldType;
case TypeFlags.ValueType:
// Drill into the struct and find the type of its first field
type = (DefType)firstFieldType;
break;
default:
Debug.Assert(false, "Why is IsHfa true on this type?");
return null;
}
}
}