本文整理汇总了C#中Internal.ToInt方法的典型用法代码示例。如果您正苦于以下问题:C# Internal.ToInt方法的具体用法?C# Internal.ToInt怎么用?C# Internal.ToInt使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Internal
的用法示例。
在下文中一共展示了Internal.ToInt方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: CreateCellFromFixupKindAndToken
//.........这里部分代码省略.........
cell = new StaticDataCell() { DataKind = staticDataKind, Type = type, Direct = true };
}
break;
case MetadataFixupKind.UnwrapNullableType:
{
var type = metadata.GetType(token);
TypeLoaderLogger.WriteLine("UnwrapNullableType of: " + type.ToString());
cell = new UnwrapNullableTypeCell() { Type = (DefType)type };
}
break;
case MetadataFixupKind.FieldLdToken:
{
var field = metadata.GetField(token);
TypeLoaderLogger.WriteLine("LdToken on: " + field.ToString());
IntPtr fieldName = TypeLoaderEnvironment.Instance.GetNativeFormatStringForString(field.Name);
cell = new FieldLdTokenCell() { FieldName = fieldName, ContainingType = field.OwningType };
}
break;
case MetadataFixupKind.MethodLdToken:
{
var method = metadata.GetMethod(token);
TypeLoaderLogger.WriteLine("LdToken on: " + method.ToString());
var nativeFormatMethod = (TypeSystem.NativeFormat.NativeFormatMethod)method.GetTypicalMethodDefinition();
cell = new MethodLdTokenCell
{
Method = method,
MethodName = IntPtr.Zero,
MethodSignature = RuntimeMethodSignature.CreateFromMethodHandle(nativeFormatMethod.MetadataUnit.RuntimeModule, nativeFormatMethod.Handle.ToInt())
};
}
break;
case MetadataFixupKind.TypeSize:
{
var type = metadata.GetType(token);
TypeLoaderLogger.WriteLine("TypeSize: " + type.ToString());
cell = new TypeSizeCell() { Type = type };
}
break;
case MetadataFixupKind.FieldOffset:
{
var field = metadata.GetField(token);
TypeLoaderLogger.WriteLine("FieldOffset: " + field.ToString());
cell = new FieldOffsetCell() { Field = field };
}
break;
case MetadataFixupKind.AllocateObject:
{
var type = metadata.GetType(token);
TypeLoaderLogger.WriteLine("AllocateObject on: " + type.ToString());
cell = new AllocateObjectCell { Type = type };
}
break;
case MetadataFixupKind.DefaultConstructor:
示例2: GetSignature
public RuntimeMethodSignature GetSignature(Internal.Metadata.NativeFormat.Handle token)
{
switch (token.HandleType)
{
// These are the only valid token types for creating a method signature
case Internal.Metadata.NativeFormat.HandleType.Method:
case Internal.Metadata.NativeFormat.HandleType.MemberReference:
case Internal.Metadata.NativeFormat.HandleType.QualifiedMethod:
case Internal.Metadata.NativeFormat.HandleType.MethodInstantiation:
case Internal.Metadata.NativeFormat.HandleType.MethodSignature:
break;
default:
Environment.FailFast("Unknown and invalid handle type");
break;
}
return RuntimeMethodSignature.CreateFromMethodHandle(_metadataUnit.RuntimeModule, token.ToInt());
}