本文整理汇总了C#中TypeDefinitionHandle.GetTypeDefinition方法的典型用法代码示例。如果您正苦于以下问题:C# TypeDefinitionHandle.GetTypeDefinition方法的具体用法?C# TypeDefinitionHandle.GetTypeDefinition怎么用?C# TypeDefinitionHandle.GetTypeDefinition使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类TypeDefinitionHandle
的用法示例。
在下文中一共展示了TypeDefinitionHandle.GetTypeDefinition方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: RuntimeInspectionOnlyNamedType
protected RuntimeInspectionOnlyNamedType(MetadataReader reader, TypeDefinitionHandle typeDefinitionHandle)
: base()
{
#if DEBUG
if (!(this.InternalViolatesTypeIdentityRules))
{
RuntimeTypeHandle runtimeTypeHandle;
if (ReflectionCoreExecution.ExecutionEnvironment.TryGetNamedTypeForMetadata(reader, typeDefinitionHandle, out runtimeTypeHandle))
Debug.Assert(false, "Type identity violation: You must use a RuntimeEENamedType to represent this type as RH has generated an EEType for it.");
}
#endif
_reader = reader;
_typeDefinitionHandle = typeDefinitionHandle;
_typeDefinition = _typeDefinitionHandle.GetTypeDefinition(_reader);
}
示例2: GetTypeFullNameFromTypeDef
private static String GetTypeFullNameFromTypeDef(TypeDefinitionHandle typeDefinitionHandle, MetadataReader reader, List<int> genericParameterOffsets)
{
String s = "";
TypeDefinition typeDefinition = typeDefinitionHandle.GetTypeDefinition(reader);
s = typeDefinition.Name.GetString(reader);
TypeDefinitionHandle enclosingTypeDefHandle = typeDefinition.EnclosingType;
if (!enclosingTypeDefHandle.IsNull(reader))
{
String containingTypeName = GetTypeFullNameFromTypeDef(enclosingTypeDefHandle, reader, genericParameterOffsets);
s = containingTypeName + "." + s;
}
else
{
NamespaceDefinitionHandle namespaceHandle = typeDefinition.NamespaceDefinition;
for (; ;)
{
NamespaceDefinition namespaceDefinition = namespaceHandle.GetNamespaceDefinition(reader);
String namespacePart = namespaceDefinition.Name.GetStringOrNull(reader);
if (namespacePart == null)
break; // Reached the root namespace.
s = namespacePart + "." + s;
if (namespaceDefinition.ParentScopeOrNamespace.HandleType != HandleType.NamespaceDefinition)
break; // Should have reached the root namespace first but this helper is for ToString() - better to
// return partial information than crash.
namespaceHandle = namespaceDefinition.ParentScopeOrNamespace.ToNamespaceDefinitionHandle(reader);
}
}
return ConvertBackTickNameToNameWithReducerInputFormat(s, genericParameterOffsets);
}
示例3: GetPsuedoCustomAttributes
public sealed override IEnumerable<CustomAttributeData> GetPsuedoCustomAttributes(MetadataReader reader, TypeDefinitionHandle typeDefinitionHandle)
{
TypeAttributes attributes = typeDefinitionHandle.GetTypeDefinition(reader).Flags;
if (0 != (attributes & TypeAttributes.Import))
yield return ReflectionCoreExecution.ExecutionDomain.GetCustomAttributeData(typeof(ComImportAttribute), null, null);
}