internal static TypeReference LoadTypeRef(Module module, int rid, bool?isValueType = null) { var image = module.Image; var typeRef = image.TypeRefSignatures[rid - 1]; if (typeRef != null) { if (isValueType.HasValue) { typeRef._isValueType = isValueType; } return(typeRef); } TypeRefRow row; image.GetTypeRef(rid, out row); int resolutionScopeToken = MetadataToken.DecompressResolutionScope(row.ResolutionScope); typeRef = new TypeReference(); typeRef._name = image.GetString(row.Name); typeRef._namespace = image.GetString(row.Namespace); typeRef._owner = LoadResolutionScope(module, resolutionScopeToken); typeRef._isValueType = isValueType; module.AddSignature(ref typeRef); image.TypeRefSignatures[rid - 1] = typeRef; return(typeRef); }