#530 – Namespaces vs. Assemblies

In .NET, code is organized into both assemblies and namespaces.

  • An assembly is a physical file containing a number of types (.exe or .dll)
  • namespace is a logical grouping representing a parent name that various types belong to

An assembly can contain types belong to one or more namespaces.  Types belonging to a single namespace can be contained in a single assembly, or spread across multiple assemblies.

Code can reference types within another assembly after including a reference to that assembly in the current project.

Code can reference types in another namespace by using the full name of the type that includes the namespace, or with an using directive.

The example below shows two assemblies, both .DLL files, containing some types.  Each assembly contains types belonging to more than one namespace.  And each namespace shown is spread across both assemblies.

Advertisement

About Sean
Software developer in the Twin Cities area, passionate about software development and sailing.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

%d bloggers like this: