how do i get a list of types in a namespace?

  • Thread starter Thread starter Darren Clark
  • Start date Start date
D

Darren Clark

Say i have namespace FOO..

and i want to get a list of all the types that are declared in FOO

how can i do this?
 
hi,

try this one:

foreach (Type type in Assembly.LoadFrom
("<your assembly location>").GetTypes())
{
Console.WriteLine(type.ToString
());
}

HTH,
 
Darren,

try this

//get the assembly
Assembly myAssembly = Assembly.GetExecutingAssembly();

//get the types defined in the assembly
System.Type [] allTypes = myAssembly.GetTypes();

Shak.
 
thank you all..

it worked!
Assembly a = Assembly.LoadFile(this.textBox1.Text.ToString());

Type[] mytypes = a.GetTypes();

foreach(Type t in mytypes)

{

tvMain.Nodes.Add(t.FullName.ToString());

}





Shakir Hussain said:
Darren,

try this

//get the assembly
Assembly myAssembly = Assembly.GetExecutingAssembly();

//get the types defined in the assembly
System.Type [] allTypes = myAssembly.GetTypes();

Shak.


Darren Clark said:
Say i have namespace FOO..

and i want to get a list of all the types that are declared in FOO

how can i do this?
 
Back
Top