PC Review


Reply
Thread Tools Rate Thread

Determine all classes within a namespace

 
 
jw56578@gmail.com
Guest
Posts: n/a
 
      14th Mar 2005
Hi,
Is there a way to discover all the classes within a given namespace?
thanks

 
Reply With Quote
 
 
 
 
Brendan Grant
Guest
Posts: n/a
 
      14th Mar 2005
There is, take a look at
http://www.ondotnet.com/pub/a/dotnet...prog_csharp_ch
18/?page=5

>-----Original Message-----
>Hi,
> Is there a way to discover all the classes within a

given namespace?
>thanks
>
>.
>

 
Reply With Quote
 
Rodger Constandse
Guest
Posts: n/a
 
      14th Mar 2005
Hi,

I don't know if there is an easier way to do this, but the brute force way is to
list all the types in the assembly, go through each type, and use the Namespace
property of the type to compare against your target.

foreach (Type type in myAssembly.GetTypes())
{
if (type.Namespace == target)
{
...
}
}

where myAssembly is the assembly you want to check. If you only want classes,
use the Type's IsClass property as part of the check.

--
Rodger Constandse

<http://www.SequenceDiagramEditor.com>
Sequence Diagram Editor - A quick and easy way to draw and edit sequence diagrams

(E-Mail Removed) wrote:
> Hi,
> Is there a way to discover all the classes within a given namespace?
> thanks
>

 
Reply With Quote
 
 
 
Reply

Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Classes and Namespace - ASP.NET 2.0 Bob Microsoft ASP .NET 1 20th Jan 2006 09:30 AM
How i list or enumerate classes (names of classes in string format) from a certain namespace? please help. Jose Michael Meo R. Barrido Microsoft VB .NET 1 31st Dec 2004 12:13 PM
How i list or enumerate classes (names of classes in string format) from a certain namespace? please help. Jose Michael Meo R. Barrido Microsoft Dot NET 1 31st Dec 2004 12:13 PM
Finding all classes within a namespace TheNedMan Microsoft Dot NET Framework 2 13th Jun 2004 07:02 PM
Q: Anyway to enumerate the Classes in a Namespace? Sky Microsoft C# .NET 3 22nd Mar 2004 12:16 AM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 07:43 PM.