[英]Assemblies and Namespace
Does everything in a single namespace compile into its own assembly?单个命名空间中的所有内容都编译成自己的程序集吗?
No.不。
You can have several namespaces in an assembly, and you can use the same namespace in different assemblies.一个程序集中可以有多个命名空间,并且可以在不同的程序集中使用相同的命名空间。
No, you can have multiple namespaces within an assembly.不,您可以在一个程序集中拥有多个命名空间。 In VS terms, you can think of an assembly as a project.
在 VS 术语中,您可以将程序集视为一个项目。 Each project within a solution, gets compiled into it's own assembly.
解决方案中的每个项目都被编译成它自己的程序集。 Within an assembly though, you can have multiple namespaces.
但是,在一个程序集中,您可以有多个命名空间。
Assemblies and namespaces have nothing to do with each other except that there's a generally used convention that the full names of classes in an assembly will match the assembly name (in some way).程序集和命名空间彼此无关,只是有一个普遍使用的约定,即程序集中的类的全名将匹配程序集名称(以某种方式)。
It's strictly a naming convention - as Guffa said , assemblies can define classes for more than one namespace and the classes that exist in a namespace can come from more than one assembly.这是一种严格的命名约定——正如Guffa 所说,程序集可以为多个命名空间定义类,并且命名空间中存在的类可以来自多个程序集。
Classes are organized in Namespaces just to keep a naming separation and organization.
类在命名空间中组织只是为了保持命名分离和组织。 Think of namespaces as "folders" that contain one or more classes, and that might be defined in one or more assemblies (DLLs).
将命名空间视为包含一个或多个类的“文件夹”,并且可能在一个或多个程序集 (DLL) 中定义。
more info: https://stackoverflow.com/a/20056937/579381更多信息: https://stackoverflow.com/a/20056937/579381
If you're asking if each namespace results in a seperate assembly, then no.如果您询问每个命名空间是否导致单独的程序集,那么没有。 One assembly can contain multiple namespaces.
一个程序集可以包含多个命名空间。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.