有没有可能获取分配给 System.Type
变量的类型的 TypeReference
或 TypeDefinition
?
更具体地说,我正在尝试从以下属性定义中获取 String
类型:
Custom(Value=typeof(String))]
public string SomeProperty {get; set;}
有没有可能获取分配给 System.Type
变量的类型的 TypeReference
或 TypeDefinition
?
更具体地说,我正在尝试从以下属性定义中获取 String
类型:
Custom(Value=typeof(String))]
public string SomeProperty {get; set;}
var a = AssemblyDefinition.ReadAssembly(typeof(Program).Assembly.Location);
var type = typeof(string);
var tr = a.MainModule.ImportReference(type);
var td = tr.Resolve();
Console.WriteLine($"tr = {tr}\ntd = {td}");