Enumerating sub-namespaces

  • Thread starter Thread starter Ed Curren
  • Start date Start date
E

Ed Curren

Hello all,
I want to enumerate the namespaces under a given
namespace. For example I would like to submit the
namespace of System and get CodeDOM, Collections,
ComponentModel, Configuration, etc. Can someone clue me
in on how to do this?

Thanks All
Ed
 
Hello all,
I want to read MSDN. For example I would like to ask a stupid question
that is already answered in there etc... Can someone hit me with a
cluestick?

Thanks all,
 
Ed Curren said:
I want to enumerate the namespaces under a given
namespace. For example I would like to submit the
namespace of System and get CodeDOM, Collections,
ComponentModel, Configuration, etc. Can someone clue me
in on how to do this?

You would need to load the assemblies you wanted to examine, and then
go through each type in each of the assemblies, and see if its
namespace matched what you wanted it to.
 
Hi Jon,
Thanks for the reply. This was the approach I had
taken before posting the question, but it did not provide
the NameSpaces, but rather the data types that were a
part of the given assembly. Below is a code snippet of
what I have been doing.

Assembly assemblyData = Assembly.GetAssembly(typeof
(Object));

Type[] types = assemblyData.GetTypes();

foreach (Type type in types) {

if (type.IsPublic) {

if ((!type.Name.StartsWith("_"))
&& (type.Namespace == "System"))

memberList.Add(new
IntelliPromptMemberListItem(type.Name, 0));

}

}
 
Back
Top