Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
使用 Mono.Cecil
if (MethodDefinition.ReturnType == AssemblyDefinition.MainModule.Import(typeof(string)))
失败是因为我阅读的程序集是 .net 2 但我的程序是 .net 4。所以它试图比较字符串 v2 和字符串 v4,所以它永远不会相等。如何在不使用 .net 2 构建程序的情况下从 v2 获取字符串?
你的问题和这个类似
简而言之,您应该能够通过以下方式获取string类型:
string
AssemblyDefinition.MainModule.TypeSystem.String