Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Namespace or Assembly?

I am getting very confused between Namespaces and Assemblies. Are System.Data and System.Web Namespaces or Assemblies?

I have noticed these are called namespaces and at the same time they are present in GAC_32 folder. So what exactly are they?

like image 252
user3125433 Avatar asked Feb 03 '14 14:02

user3125433


People also ask

What is namespace and assemblies?

A namespace is a logical grouping of types (mostly to avoid name collisions). An assembly can contain types in multiple namespaces ( System. DLL contains a few...), and a single namespace can be spread across assemblies (e.g. System. Threading ).

What is namespace and assembly in C#?

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.

Which choice best describe the difference between a namespace and assembly?

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.

What is the difference between namespace and namespace name?

A namespace is a theoretical space in which the link between names and objects are situated: that is what is called a mapping between the names and the objects. Names are the identifiers written in a script. Objects are structures of bits lying in the memory.


2 Answers

System.Data is a namespace, System.Data.DLL (the file) is an assembly.

A namespace is a logical grouping of types (mostly to avoid name collisions). An assembly can contain types in multiple namespaces (System.DLL contains a few...), and a single namespace can be spread across assemblies (e.g. System.Threading).

like image 111
D Stanley Avatar answered Sep 19 '22 14:09

D Stanley


Namespace is a logical grouping of classes belongs to same functionality. So System.Web and System.Data are namespaces

MSDN describe it as:

Namespaces are heavily used in C# programming in two ways. First, the .NET Framework uses namespaces to organize its many classes Secondly, declaring your own namespaces can help control the scope of class and method names in larger programming projects.

namespace

Assembly is chunk of (precompiled) code that can be executed by the .NET runtime environment. It contains one or more than one Namespaces. A .NET program consists of one or more assemblies.

System.Web.dll and System.Data.dll are assemblies.

MSDN describe it as:

Assemblies are the building blocks of .NET Framework applications; they form the fundamental unit of deployment, version control, reuse, activation scoping, and security permissions. An assembly is a collection of types and resources that are built to work together and form a logical unit of functionality. An assembly provides the common language runtime with the information it needs to be aware of type implementations. To the runtime, a type does not exist outside the context of an assembly.

assembly

like image 30
Zaheer Ahmed Avatar answered Sep 20 '22 14:09

Zaheer Ahmed