开发者

Get all classes inside a namespace [duplicate]

开发者 https://www.devze.com 2023-01-09 00:34 出处:网络
This question already has answers here: Getting all types in a namespace via reflection (11 answers) 开发者_运维知识库
This question already has answers here: Getting all types in a namespace via reflection (11 answers) 开发者_运维知识库 Closed 9 years ago.

How can I get all classes inside a namespace?


You cannot. Classes are not "in" namespaces. Classes have namespaces as part of their name.

The classes "in" a namespace may reside in multiple assemblies. For example, some of the types in the System namespace reside in mscorlib.dll, and others reside in System.dll. You would have to go through all of the types in all of the assemblies you could find to be certain that you had found all the types "in" a particular namespace.


As @hawk mentioned, the answer is located here, with sample code that you can use:

Getting all types in a namespace via reflection


Use Reflector to see them (assuming that all the classes are in the same assembly).

0

精彩评论

暂无评论...
验证码 换一张
取 消