Get all classes inside a namespace
11,916
Solution 1
As @hawk mentioned, the answer is located here, with sample code that you can use:
Getting all types in a namespace via reflection
Solution 2
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.
Author by
Andreas
Updated on June 16, 2022Comments
-
Andreas almost 2 years
How can I get all classes inside a namespace?
-
John Saunders almost 14 yearsIs this a web site, created with File->New Web Site? In that case, I think you're completely out of luck. Web Sites don't build into a single assembly - there's one per page (I don't know which assembly the App_Code classes go into). Maybe you'd get lucky and could use Assembly.GetExecutingAssembly to find the current assembly, do GetTypes on that and go through them all.