Why does Assembly.GetTypes() require references?

后端 未结 4 1971
[愿得一人]
[愿得一人] 2021-01-12 16:34

I want to get all of the types from my assembly, but I don\'t have the references, nor do I care about them. What does finding the interface types have to do with the refere

4条回答
  •  旧时难觅i
    2021-01-12 17:07

    An alternative to using the reflection only context might be Mono.Cecil by Jb Evain which is also available via NuGet.

    ModuleDefinition module = ModuleDefinition.ReadModule(myAssemblyPath);
    Collection types = module.Types;
    

提交回复
热议问题