Sharing a namespace across different assemblies - what are the issues?

Posted on 2012-09-07
Medium Priority
Last Modified: 2012-09-10
Due to dependency issues I am having to move some of my code between assemblies.

However I would like to keep the original namespace - are there any issues with sharing a namespace across assemblies that I should be aware of?

I'm using VS 2010 and .NET 4.
Question by:purplesoup
LVL 45

Assisted Solution

AndyAinscow earned 300 total points
ID: 38377541
As far as I know - none (assuming there isn't another assembly that happens to have the same namespace that is).
LVL 13

Accepted Solution

Naman Goel earned 1400 total points
ID: 38380664
It's definitely possible and there is nothing wrong with it. The .NET
framework itself has namespaces spread across multiple assemblies. For
example, the System.Data namespace and the System.Web, System.Web,
System.Drawing, etc., etc., etc. namespaces are implemented in multiple

It's perfectly fine in my opinion as long as it is clear to the users of
your class library that what assembly they will need to reference for given
LVL 75

Assisted Solution

by:käµfm³d 👽
käµfm³d   👽 earned 300 total points
ID: 38381660
The only "problem" I can think of is if you just happen to have a class in each assembly (and namespace) with the same name. In that case, you would not be able to rely on a "using someNamespace;" at the top of your code file; you would have to fully-qualify each declaration (if the two classes are being used in the same code file).

Author Comment

ID: 38383573
ok great -thanks for all your comments.

Featured Post

What does it mean to be "Always On"?

Is your cloud always on? With an Always On cloud you won't have to worry about downtime for maintenance or software application code updates, ensuring that your bottom line isn't affected.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Today I had a very interesting conundrum that had to get solved quickly. Needless to say, it wasn't resolved quickly because when we needed it we were very rushed, but as soon as the conference call was over and I took a step back I saw the correct …
This article shows how to deploy dynamic backgrounds to computers depending on the aspect ratio of display
Is your data getting by on basic protection measures? In today’s climate of debilitating malware and ransomware—like WannaCry—that may not be enough. You need to establish more than basics, like a recovery plan that protects both data and endpoints.…
This lesson discusses how to use a Mainform + Subforms in Microsoft Access to find and enter data for payments on orders. The sample data comes from a custom shop that builds and sells movable storage structures that are delivered to your property. …
Suggested Courses
Course of the Month13 days, 17 hours left to enroll

809 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question