What's the difference between the two?
The main difference between namespace and assembly is that a namespace is a logical group of related classes that can be used by the languages targeted by Microsoft . NET framework, while Assembly is a building block of .
The root namespace is the mainspace of the . NET Framework libraries. It may happen that someone creates a type or a namespace that will conflict with ones from the . NET Framework.
Which choice best describes the difference between a namespace and an assembly? Namespace contains code to form MSIL (Microsoft Intermediate Language). An assembly contains a set of unique names.
Difference Between Namespace and Assembly. Assembly will contain Namespaces, Classes, Data types it's a small unit of code for deployment. Assembly defines the name of the . dll file.It also avoids dll hell problem. Namespace is used in order to avoid conflict of user defined classes.
Assuming that you are talking about .NET (with relation to Visual Studio) then the root namespace is what each class you create in a visual studio project will become part of. It is also the base for any sub-namespaces that are automatically assigned when you create a class inside of a project folder.
So with a base namespace of ACMECorp.Bombs all of your classes would become part of the ACMECorp.Bombs namespace so the class GravityBomb would have a full name of ACMECorp.Bombs.GravityBomb. A class called FlyingBomb created in a project folder called GuidedBombs would have a full type name of ACMECorp.Bombs.GuidedBombs.FlyingBomb.
The Assembly name is simply the name of the compiled file that your code will be compiled to as either an executable or library etc...
A question that I often see on this is should your assembly name be the same as the root namespace and also be the same as your project name (again in visual studio). I used to be of the mind set that you should have a project name the same as the assembly name the same as the root namespace just as is the default with visual studio. However if you need to do some major refactoring and renaming this can become a pain in the bum, especially if you are using source control (as you then should start renaming the project folders).
My suggestion would be that your project name is simply a descriptive name of the contents of the project. Your assembly name should consist of the technology area and component description, or company name and technology area (depending on your preferance), and your root namespace should be as described by the Microsoft naming standards so:
Project: Biometric Device Access
Assembly: BiometricFramework.DeviceAccess.dll
Namespace: ACME.BiometricFramework.DeviceAccess
Some reference material for you:
http://blogs.msdn.com/brada/archive/2003/04/19/49992.aspx
http://msdn.microsoft.com/en-us/library/ms229026.aspx
http://msdn.microsoft.com/en-us/library/ms229048.aspx
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With