.NET namespaces

前端 未结 9 2392
面向向阳花
面向向阳花 2020-12-31 18:38

My background is primarily as a Java Developer, but lately I have been doing some work in .NET. So I have been trying to do some simple projects at home to get better at wor

9条回答
  •  Happy的楠姐
    2020-12-31 19:27

    the difference is that .net namespaces have nothing much to do with java packages.

    .net namespaces are purely for managing declarative scope, and have nothing to do with files, projects or their locations.

    it's very simple everything declared in a particular namespace is accessible when you include a 'using' to that namespace.

    very easy.

    the choice of name and whether or not/how many '.' seperators you use is entirely up to you.

    VS defaults to adding .foldernames to your namespaces just to try and be helpful.

    this article explains namespaces quite well: http://www.blackwasp.co.uk/Namespaces.aspx

    It also has an example naming convention toward the end, although your name convention is your call! ;)

    that said, most places i've worked at and people i've worked with start with company name which is sensible, as it makes typenames for that company distinct, (separate from other, libraries, vendors, opensource projcts etc.)

提交回复
热议问题