.NET interview questions: - What is Assembly and Namespace? What are the different types of Assembly? State differences between them?
Following is .NET interview questions on Assembly and Namespace in .NET.
Assembly is unit of deployment like EXE or a DLL.
- It logically groupsclasses, for instance System.Web.UI logically groups UI related features like textboxes, list control etc.
- In Object Oriented world, many times it is possible that programmers will use the same class name. Qualifying NameSpace with class names avoids this collision.
Different types of Assembly: -
There are two types of assembly Private and Public assembly. A private assembly is normally used by a single application, and is stored in the application’s directory, or a sub-directory beneath. A shared assembly is stored in the global assembly cache, which is a repository of assemblies maintained by the .NET runtime.
Shared assemblies are needed when we want the same assembly to be shared by various applications in the same computer.
Difference between NameSpace and Assembly: -
Following are the differences between namespace and assembly:
- Assembly is physical grouping of logical units, Namespace, logically groupsclasses.
- Namespace can span multiple assemblies while assembly is a physical unit like EXE, DLL etc.