本文整理汇总了C#中Internal.TypeSystem.FieldDesc.GetTypicalFieldDefinition方法的典型用法代码示例。如果您正苦于以下问题:C# FieldDesc.GetTypicalFieldDefinition方法的具体用法?C# FieldDesc.GetTypicalFieldDefinition怎么用?C# FieldDesc.GetTypicalFieldDefinition使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Internal.TypeSystem.FieldDesc
的用法示例。
在下文中一共展示了FieldDesc.GetTypicalFieldDefinition方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: GetFieldRvaData
/// <summary>
/// Gets an object representing the static data for RVA mapped fields from the PE image.
/// </summary>
public ObjectNode GetFieldRvaData(FieldDesc field)
{
if (field.GetType() == typeof(Internal.IL.Stubs.PInvokeLazyFixupField))
{
var pInvokeFixup = (Internal.IL.Stubs.PInvokeLazyFixupField)field;
PInvokeMetadata metadata = pInvokeFixup.PInvokeMetadata;
return NodeFactory.PInvokeMethodFixup(metadata.Module, metadata.Name);
}
else
{
// Use the typical field definition in case this is an instantiated generic type
field = field.GetTypicalFieldDefinition();
return NodeFactory.ReadOnlyDataBlob(NameMangler.GetMangledFieldName(field),
((EcmaField)field).GetFieldRvaData(), NodeFactory.Target.PointerSize);
}
}
示例2: ComputeHasGCStaticBase
protected internal override bool ComputeHasGCStaticBase(FieldDesc field)
{
Debug.Assert(field.IsStatic);
if (field is NativeLayoutFieldDesc)
{
return ((NativeLayoutFieldDesc)field).FieldStorage == Internal.NativeFormat.FieldStorage.GCStatic;
}
TypeDesc fieldType = field.FieldType;
if (fieldType.IsValueType)
{
FieldDesc typicalField = field.GetTypicalFieldDefinition();
if (field != typicalField)
{
if (typicalField.FieldType.IsSignatureVariable)
return true;
}
if (fieldType.IsEnum || fieldType.IsPrimitive)
return false;
return true;
}
else
return fieldType.IsGCPointer;
}