Assemblies and Namespace

后端 未结 5 861
别那么骄傲
别那么骄傲 2021-01-18 16:56

Does everything in a single namespace compile into its own assembly?

相关标签:
5条回答
  • 2021-01-18 16:59

    If you're asking if each namespace results in a seperate assembly, then no. One assembly can contain multiple namespaces.

    0 讨论(0)
  • 2021-01-18 17:13

    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.

    0 讨论(0)
  • 2021-01-18 17:18

    No.

    You can have several namespaces in an assembly, and you can use the same namespace in different assemblies.

    0 讨论(0)
  • 2021-01-18 17:20

    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).

    more info: https://stackoverflow.com/a/20056937/579381

    0 讨论(0)
  • 2021-01-18 17:22

    No, you can have multiple namespaces within an assembly. In VS terms, you can think of an assembly as a project. Each project within a solution, gets compiled into it's own assembly. Within an assembly though, you can have multiple namespaces.

    0 讨论(0)
提交回复
热议问题