本文整理汇总了C#中IKVM.Reflection.Type.GetEnumUnderlyingType方法的典型用法代码示例。如果您正苦于以下问题:C# Type.GetEnumUnderlyingType方法的具体用法?C# Type.GetEnumUnderlyingType怎么用?C# Type.GetEnumUnderlyingType使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类IKVM.Reflection.Type
的用法示例。
在下文中一共展示了Type.GetEnumUnderlyingType方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: ReadFixedArg
//.........这里部分代码省略.........
}
}
sb.Append(QuoteIdentifier(str, true));
}
}
else if (type == typeofSystemObject)
{
string typeName;
ReadFixedArg(sb, br, ReadFieldOrPropType(sb, br, out typeName));
}
else
{
throw new NotImplementedException(type.FullName);
}
if (!arrayElement)
{
sb.Append(')');
}
}
else if (type.__IsMissing || (compat != CompatLevel.None && typerefs.Contains(type)))
{
// ildasm actually tries to load the assembly, but we can't do that, so we cheat by having
// a list of 'known' enum types
if (type.Assembly.GetName().Name == "mscorlib")
{
switch (type.FullName)
{
case "System.AttributeTargets":
case "System.Runtime.ConstrainedExecution.Consistency":
case "System.Runtime.ConstrainedExecution.Cer":
case "System.Security.Permissions.SecurityAction":
case "System.Security.Permissions.SecurityPermissionFlag":
case "System.Runtime.Versioning.ResourceScope":
case "System.Runtime.InteropServices.CallingConvention":
case "System.Runtime.InteropServices.CharSet":
ReadFixedArg(sb, br, typeofSystemInt32);
return;
case "System.Security.SecurityRuleSet":
if (compat != CompatLevel.V20)
{
ReadFixedArg(sb, br, typeofSystemByte);
return;
}
break;
case "System.Diagnostics.Tracing.EventLevel":
case "System.Diagnostics.Tracing.EventTask":
case "System.Diagnostics.Tracing.EventOpcode":
if (compat != CompatLevel.V20 && compat != CompatLevel.V40)
{
ReadFixedArg(sb, br, typeofSystemInt32);
return;
}
break;
case "System.Type":
sb.Append("type(");
string typeName;
AppendTypeName(sb, ReadType(br, out typeName), typeName);
sb.Append(")");
return;
}
}
switch (br.Length)
{
case 1:
if (compat != CompatLevel.None)
{
// ildasm uses bool (???) as the underlying type in this case
sb.AppendFormat("bool({0})", br.ReadByte() == 0 ? "false" : "true");
}
else
{
// just guess that the enum has int8 as the underlying type
sb.AppendFormat("int8({0})", br.ReadSByte());
}
break;
case 2:
// just guess that the enum has int16 as the underlying type
sb.AppendFormat("int16({0})", br.ReadInt16());
break;
case 4:
// just guess that the enum has int32 as the underlying type
sb.AppendFormat("int32({0})", br.ReadInt32());
break;
case 8:
// just guess that the enum has int64 as the underlying type
sb.AppendFormat("int64({0})", br.ReadInt64());
break;
default:
throw new IKVM.Reflection.BadImageFormatException();
}
}
else if (type.IsEnum)
{
ReadFixedArg(sb, br, type.GetEnumUnderlyingType(), arrayElement);
}
else
{
throw new NotImplementedException(type.FullName);
}
}