我正在尝试使用 Cecil 检查与给定方法关联的属性。它似乎找到了它,但我无法使用以下代码获取它的名称:
AssemblyDefinition assembly = AssemblyFactory.GetAssembly(pathBin);
assembly.MainModule.Types[0].Methods[1].CustomAttributes[0].ToString()
我知道这一定是我将函数设置为的属性,因为当我从 dll 中删除它时,第二行代码将变为 null。我想做的是能够获得属性的名称。目前第二行代码将只返回一个“Mono.Cecil.CustomAttribute”。我猜应该有一种获取属性名称(类类型)名称的方法,对吧?
谢谢!