473,320 Members | 2,122 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,320 software developers and data experts.

Adding to an existing NameSpace

After creating a namespace in one file how would I add to that a new object
in the same namespace in a diffrent file?

IE
FILE1 contains namespace FINANCE
FILE2 has object that want to exist in the FINANCE namespace

Can this be done without adding the classes to FILE1?

Thanks
Davinci
Nov 16 '05 #1
3 2078
Just declare the fully formed namespace in the new file such as:

namespace Foo.Bar.Re.Po
{
}
--
Bob Powell [MVP]
Visual C#, System.Drawing

Find great Windows Forms articles in Windows Forms Tips and Tricks
http://www.bobpowell.net/tipstricks.htm

Answer those GDI+ questions with the GDI+ FAQ
http://www.bobpowell.net/faqmain.htm

All new articles provide code in C# and VB.NET.
Subscribe to the RSS feeds provided and never miss a new article.

"Davinci_Jeremie" <Da************@discussions.microsoft.com> wrote in
message news:BF**********************************@microsof t.com...
After creating a namespace in one file how would I add to that a new
object
in the same namespace in a diffrent file?

IE
FILE1 contains namespace FINANCE
FILE2 has object that want to exist in the FINANCE namespace

Can this be done without adding the classes to FILE1?

Thanks
Davinci

Nov 16 '05 #2
Davinci_Jeremie <Da************@discussions.microsoft.com> wrote:
After creating a namespace in one file how would I add to that a new object
in the same namespace in a diffrent file?

IE
FILE1 contains namespace FINANCE
FILE2 has object that want to exist in the FINANCE namespace

Can this be done without adding the classes to FILE1?


Just declare the namespace again. Note that you're not adding an
*object* to a namespace, you're adding a *type* to a namespace.

--
Jon Skeet - <sk***@pobox.com>
http://www.pobox.com/~skeet
If replying to the group, please do not mail me too
Nov 16 '05 #3
Yes.

Just declare the classes in FILE2 to be in the namespace you want them
in.

Projects using classes from that namespace will not know that the
namespace is in more than one DLL unless you refer to something defined
in that namespace but in a DLL that your project doesn't contain a
reference to. If you do this, the compiler will complain that it can't
find that class (or whatever) in that namespace, and maybe you're
missing a DLL reference?

If you write a project that only ever refers to things in FILE1, the
compiler doesn't know that there is "more" of the same namespace in
FILE2, and doesn't care.

Nov 16 '05 #4

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

Similar topics

2
by: Junkmail | last post by:
I've been playing with Zope for about a year and took the plunge last week into making a product. To keep it simple I used a ZClass to wrap an external method. My ZClass works and returns the...
34
by: Adam Hartshorne | last post by:
Hi All, I have the following problem, and I would be extremely grateful if somebody would be kind enough to suggest an efficient solution to it. I create an instance of a Class A, and...
1
by: Christopher W. Douglas | last post by:
I am building a VB.NET application in Visual Studio.NET 2003. I have an existing project with code and forms I want to reuse in this project. If I am copying a module file, then Add Existing Item...
47
by: Pierre Barbier de Reuille | last post by:
Please, note that I am entirely open for every points on this proposal (which I do not dare yet to call PEP). Abstract ======== This proposal suggests to add symbols into Python. Symbols...
4
by: Håvard Olerud Eriksen | last post by:
I've got a dll which houses a namespace hierarchy of useful utilities. I decided that I wanted to add another class to this namespace today. I then started up the project, copied the class file to...
2
by: Jay Balapa | last post by:
Hello, We have a webservice which is called by our pocket pc apps. We have a need to filter data, so we want to add a another method on top to the existing method. Existing Service.asmx...
8
by: Jason | last post by:
Hello, I am trying to utilitze the AJAX Control toolkit in my asp.net project. I have added a reference to AjaxControlToolkit.dll, and in my page, added these lines of code: ...
0
by: AboutJAV | last post by:
Hi, I got a crystal report (.rpt + .cs files) and the dataset (xsd + cs + designer.cs + .xsc + .xss). I added them to my project and changed the namespace values in the cs files. When I added...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: Vimpel783 | last post by:
Hello! Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
0
by: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
1
by: Shællîpôpï 09 | last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....
0
by: af34tf | last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...

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.