• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 803
  • Last Modified:

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

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.
0
purplesoup
Asked:
purplesoup
3 Solutions
 
AndyAinscowFreelance programmer / ConsultantCommented:
As far as I know - none (assuming there isn't another assembly that happens to have the same namespace that is).
0
 
Naman GoelSoftware engineer 1Commented:
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
assemblies.

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
functionality.
0
 
käµfm³d 👽Commented:
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).
0
 
purplesoupAuthor Commented:
ok great -thanks for all your comments.
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

Join & Write a Comment

Featured Post

Cloud Class® Course: SQL Server Core 2016

This course will introduce you to SQL Server Core 2016, as well as teach you about SSMS, data tools, installation, server configuration, using Management Studio, and writing and executing queries.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now