public static bool LookupPrimitive(Type type, out System.Reflection.Adds.CorElementType result) { result = System.Reflection.Adds.CorElementType.End; ITypeUniverse typeUniverse = Helpers.Universe(type); if (typeUniverse != null && !typeUniverse.GetSystemAssembly().Equals(type.Assembly)) { return(false); } return(SignatureUtil.TypeMapForAttributes.s_typeNameMapForAttributes.TryGetValue(type.FullName, out result)); }
internal static Type ExtractTypeValue(ITypeUniverse universe, Module module, byte[] blob, ref int index) { Type type = null; string str = SignatureUtil.ExtractStringValue(blob, ref index); if (!string.IsNullOrEmpty(str)) { type = System.Reflection.Adds.TypeNameParser.ParseTypeName(universe, module, str, false); if (type == null) { module = universe.GetSystemAssembly().ManifestModule; type = System.Reflection.Adds.TypeNameParser.ParseTypeName(universe, module, str); } } return(type); }
public static IEnumerable <CustomAttributeData> GetTypeForwardedToAttributes(MetadataOnlyModule manifestModule) { ITypeUniverse assemblyResolver = manifestModule.AssemblyResolver; Type builtInType = assemblyResolver.GetBuiltInType(System.Reflection.Adds.CorElementType.Type); Assembly assembly = assemblyResolver.GetSystemAssembly(); Type type = assembly.GetType("System.Runtime.CompilerServices.TypeForwardedToAttribute", false, false); if (type != null) { foreach (UnresolvedTypeName rawTypeForwardedToAttribute in PseudoCustomAttributes.GetRawTypeForwardedToAttributes(manifestModule)) { ConstructorInfo[] constructorInfoArray = type.GetConstructors(); Type type1 = rawTypeForwardedToAttribute.ConvertToType(assemblyResolver, manifestModule); List <CustomAttributeTypedArgument> customAttributeTypedArguments = new List <CustomAttributeTypedArgument>(1) { new CustomAttributeTypedArgument(builtInType, type1) }; List <CustomAttributeNamedArgument> customAttributeNamedArguments = new List <CustomAttributeNamedArgument>(0); yield return(new MetadataOnlyCustomAttributeData(constructorInfoArray[0], customAttributeTypedArguments, customAttributeNamedArguments)); } } }