How to get the assembly (System.Reflection.Assembly) for a given type in .Net?

前端 未结 5 1266
天涯浪人
天涯浪人 2020-12-09 14:41

In .Net, given a type name, is there a method that tells me in which assembly (instance of System.Reflection.Assembly) that type is defined?

I assume that my project

5条回答
  •  南笙
    南笙 (楼主)
    2020-12-09 15:31

    If you can use it, this syntax is the shortest/cleanest:

    typeof(int).Assembly
    

提交回复
热议问题