Determining assembly from namespace

  • Thread starter Thread starter Ludwig Wittgenstein
  • Start date Start date
L

Ludwig Wittgenstein

Hi,
I know that in .NET an assembly can host several namespaces, or a
namespace can be spread across several assemblies. However, is there a
way to determine which assembly uses a specific namespace? For
instance, how would you find out which assembly has hte
System.Collections namespace?



Thanks,
 
However, is there a
way to determine which assembly uses a specific namespace? For
instance, how would you find out which assembly has hte
System.Collections namespace?

Not in general, no. Any assembly on the system can add types to a
namespace so you would have to load every assembly available to find
out.


Mattias
 
You said yourself why you can't do it .. a namespace can be spread accross
several assemblies. There would be nothing to resolve back to (unless you
built a full map)
 
Ludwig,
Are you asking programmatically or as you are coding?

As the others state programmatically you really cannot per se. You could
iterate all the loaded assemblies, then iterate all the types in an
assembly, looking for the desired namespace...


While coding I normally use either the object browser or MSDN to find out
what assembly or assemblies are needed for a specific type in a specific
namespace. As you pointed out a namespace could be in multiple assemblies...

--
Hope this helps
Jay B. Harlow [MVP - Outlook]
..NET Application Architect, Enthusiast, & Evangelist
T.S. Bradley - http://www.tsbradley.net


| Hi,
| I know that in .NET an assembly can host several namespaces, or a
| namespace can be spread across several assemblies. However, is there a
| way to determine which assembly uses a specific namespace? For
| instance, how would you find out which assembly has hte
| System.Collections namespace?
|
|
|
| Thanks,
|
 
Back
Top