internal TypeReference CreateReference() { return(new TypeReference(@namespace, name, module, scope) { DeclaringType = declaring_type != null?declaring_type.CreateReference() : null, }); }
private TypeReference LookupTypeForwarded(string @namespace, string name) { if (base.module.HasExportedTypes) { Collection <ExportedType> exportedTypes = base.module.ExportedTypes; for (int i = 0; i < exportedTypes.Count; i++) { ExportedType type = exportedTypes[i]; if ((type.Name == name) && (type.Namespace == @namespace)) { return(type.CreateReference()); } } } return(null); }
private TypeReference LookupTypeForwarded(string @namespace, string name) { if (!this.module.HasExportedTypes) { return(null); } Collection <ExportedType> exportedTypes = this.module.ExportedTypes; for (int i = 0; i < exportedTypes.Count; i++) { ExportedType item = exportedTypes[i]; if (item.Name == name && item.Namespace == @namespace) { return(item.CreateReference()); } } return(null); }
public static CustomAttribute GetExportedTypeAttribute(ExportedType exportedType, ModuleDefinition module) { MethodReference ctor = Utilities.GetEmptyConstructor(typeof(System.Runtime.CompilerServices.TypeForwardedToAttribute), module, new[] { typeof(System.Type) }); CustomAttribute exportedTypeAttribute = new CustomAttribute(ctor); TypeReference systemType = Utilities.GetCorlibTypeReference(typeof(Type), module); TypeReference type = exportedType.CreateReference(); exportedTypeAttribute.ConstructorArguments.Add(new CustomAttributeArgument(systemType, type)); return exportedTypeAttribute; }