473,387 Members | 1,486 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,387 software developers and data experts.

Getting a list of available Namspaces for an assembly

I want to find out all the namespaces for an assembly and convert them into
a tree that I can then traverse for use in an autocomplete popup. Now I
figure I can do it by running over all the exported types of the assembly
and getting the namespaces they are in but is there a better way???
Regards
Lee
Nov 15 '05 #1
3 1346
Hi,

Lee Alexander wrote:
I want to find out all the namespaces for an assembly and convert them into
a tree that I can then traverse for use in an autocomplete popup. Now I
figure I can do it by running over all the exported types of the assembly
and getting the namespaces they are in but is there a better way???


As i see in docs, namespaces are only "Type" property.

I think that only way is to iterate all types and create treeView
nodes only when those aren't exists.

e.g. if treeview has namespaces only

1. type "FirstSpace.SecondSpace.FirstType"

add node "FirstSpace"
set current at "FirstSpcae"
add node "SecondSpace"

2. type "FirstSpace.SecondType"

do nothing

3. type "FirstSpace.ThirdSpace.ThirdType"

set current at "FirstSpcae"
add node "ThirdSpace"

4. type "FirstSpace.SecondSpace.FourthType"

do nothing

Regards

Marcin

Nov 15 '05 #2
Thanks I figured I would have to go over the assembly manually; not a big
deal.

Regards
Lee

"Kevin McNeish [C# MVP]" <ke****@oakleafsd.com> wrote in message
news:uf**************@tk2msftngp13.phx.gbl...
Lee,
I want to find out all the namespaces for an assembly and convert them

into
a tree that I can then traverse for use in an autocomplete popup. Now I
figure I can do it by running over all the exported types of the assembly and getting the namespaces they are in but is there a better way???


It is the best way...you can do a foreach loop like this:

foreach (Type type in assembly.GetTypes())
{
// Processing code
}

Regards,
Kevin McNeish
.NET /C# MVP
Chief Software Architect, Mere Mortals .NET Framework
www.oakleafsd.com

Nov 15 '05 #3
Thanks for your reply, I was really looking for an out of the box solution
but it's not a big deal to do it anyway. I was just checking so as to not
reinvent the wheel.

Regards
Lee

"Marcin Grzębski" <mg*******@stop.spam.taxussi.com.pl> wrote in message
news:bi**********@atlantis.news.tpi.pl...
Hi,

Lee Alexander wrote:
I want to find out all the namespaces for an assembly and convert them into a tree that I can then traverse for use in an autocomplete popup. Now I
figure I can do it by running over all the exported types of the assembly and getting the namespaces they are in but is there a better way???


As i see in docs, namespaces are only "Type" property.

I think that only way is to iterate all types and create treeView
nodes only when those aren't exists.

e.g. if treeview has namespaces only

1. type "FirstSpace.SecondSpace.FirstType"

add node "FirstSpace"
set current at "FirstSpcae"
add node "SecondSpace"

2. type "FirstSpace.SecondType"

do nothing

3. type "FirstSpace.ThirdSpace.ThirdType"

set current at "FirstSpcae"
add node "ThirdSpace"

4. type "FirstSpace.SecondSpace.FourthType"

do nothing

Regards

Marcin

Nov 15 '05 #4

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

1
by: David Tucker | last post by:
i have an xml document that needs to use multiple dtds. each dtd may have the same element names in general but some will differe slightly. I want to use namspaces but every time I do so it...
19
by: RAJASEKHAR KONDABALA | last post by:
Hi, Does anybody know what the fastest way is to "search for a value in a singly-linked list from its tail" as oposed to its head? I am talking about a non-circular singly-linked list, i.e.,...
3
by: Vittal | last post by:
Hello, Is it possible to write a C program to find out what all the dynamic and static libraries any executable is using. I mean program should do what 'ldd' does on Unix and it should help me...
1
by: Dave Wurtz | last post by:
All, Is it possible to get all of the current namespaces that are available through reflection? What I am trying to do is get back all of the namespaces, then classes within the namespaces,...
8
by: Charles Law | last post by:
I'm sorry to keep harping on about this one, but it is really quite important for me to be able to list _all_ required assemblies in my Help About box. Herfried kindly posted some code before that...
1
by: Brian Henry | last post by:
I need to mark assemblies with a unique id (GUID in this case) and retrieve it when the assembly is loaded into my application (a plug-in loader)... the plug-in assembly all have a class in it...
4
by: _AnonCoward | last post by:
It occurred to me recently that I would like to programmatically get a list of all the classes available to me for a given framework (i.e.: 1.0, 1.1, 2.0). Any ideas on how to approach that...
0
by: ruju00 | last post by:
I am getting an error in Login() method of the following class FtpConnection public class FtpConnection { public class FtpException : Exception { public FtpException(string message) :...
2
by: Manikandan | last post by:
Hi, I have a program written in .Net Framework 1.1 using Visual studio enterprise edition 2003. I tried compiling the same program in visual c# express edition 2005. I'm getting following...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.