Do an assembly have multiple namespaces or is composed of single namespace
Can an开发者_StackOverflow assemble have multiple namespaces or is composed of single namespace.
- An assemblies is a collection of code - objects, methods, properties, and other resources.
- A Namespace is a logical groupings of those things.
An assembly can contain multiple namespaces, because it can contain multiple logical groupings of objects and methods. Most assemblies I've seen are a single namespace, just for clarity, but there's no reason a single assembly couldn't contain a dozen different namespaces.
The hierarchy is:
Assemblies
contain Resources
and Modules
.
Modules
contain Fields
,Methods
, and Types
.
Types
may be qualified by any arbitrary namespace, provided that it doesn't conflict with another existing Type
.
Assemblies can short circuit past the Module level directly to all Types contained in all Modules in the assembly (via GetType() or GetTypes()).
Assemblies can have multiple namespaces.
Please see the msdn article Understanding and Using Assemblies and Namespaces in .net, that should clear up what does assembly mean and what does namespace mean.
精彩评论