本文整理汇总了C#中TypeDef.EffectiveName方法的典型用法代码示例。如果您正苦于以下问题:C# TypeDef.EffectiveName方法的具体用法?C# TypeDef.EffectiveName怎么用?C# TypeDef.EffectiveName使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类TypeDef
的用法示例。
在下文中一共展示了TypeDef.EffectiveName方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: AddTypeDef
// ----------------------------------------------------------------------
// Type definitions
// ----------------------------------------------------------------------
private void AddTypeDef(DllSaveContext ctxt, TypeDef typeDef)
{
var name = typeDef.EffectiveName(rootEnv.Global);
//
// Flags
//
var flags = default(PE.TypeAttributes);
foreach (var annot in typeDef.Annotations)
{
var access = annot as AccessibilityAnnotation;
if (access != null)
{
switch (access.Accessibility)
{
case Accessibility.CompilerControlled:
break;
case Accessibility.Private:
flags |= name.IsNested ? PE.TypeAttributes.NestedPrivate : PE.TypeAttributes.NotPublic;
break;
case Accessibility.FamilyANDAssembly:
flags |= name.IsNested ? PE.TypeAttributes.NestedFamANDAssem : PE.TypeAttributes.NotPublic;
break;
case Accessibility.Assembly:
flags |= name.IsNested ? PE.TypeAttributes.NestedAssembly : PE.TypeAttributes.NotPublic;
break;
case Accessibility.Family:
flags |= name.IsNested ? PE.TypeAttributes.NestedFamily : PE.TypeAttributes.NotPublic;
break;
case Accessibility.FamilyORAssembly:
flags |= name.IsNested ? PE.TypeAttributes.NestedFamORAssem : PE.TypeAttributes.NotPublic;
break;
case Accessibility.Public:
flags |= name.IsNested ? PE.TypeAttributes.NestedPublic : PE.TypeAttributes.Public;
break;
default:
throw new ArgumentOutOfRangeException();
}
}
var layout = annot as TypeInteropAnnotation;
if (layout != null)
{
switch (layout.Layout)
{
case TypeLayout.Auto:
flags |= PE.TypeAttributes.AutoLayout;
break;
case TypeLayout.Sequential:
flags |= PE.TypeAttributes.SequentialLayout;
break;
case TypeLayout.Explicit:
flags |= PE.TypeAttributes.ExplicitLayout;
break;
default:
throw new ArgumentOutOfRangeException();
}
switch (layout.StringFormat)
{
case StringFormat.Auto:
flags |= PE.TypeAttributes.AutoClass;
break;
case StringFormat.Ansi:
flags |= PE.TypeAttributes.AnsiClass;
break;
case StringFormat.Unicode:
flags |= PE.TypeAttributes.UnicodeClass;
break;
case StringFormat.Custom:
flags |= PE.TypeAttributes.CustomFormatClass;
break;
default:
throw new ArgumentOutOfRangeException();
}
if (layout.IsSerializable)
flags |= PE.TypeAttributes.Serializable;
}
var security = annot as TypeSecurityAnnotation;
if (security != null && security.HasSecurity)
flags |= PE.TypeAttributes.HasSecurity;
var specialName = annot as SpecialNameAnnotation;
if (specialName != null)
{
flags |= PE.TypeAttributes.SpecialName;
if (specialName.IsRuntime)
flags |= PE.TypeAttributes.RTSpecialName;
}
}
if (typeDef is InterfaceTypeDef)
flags |= PE.TypeAttributes.Interface;
//.........这里部分代码省略.........