在C#中,个人命名空间的命名约定是什么?

In C#, what are the namespace naming conventions for individuals?

我正在尝试为我作为个人在公司环境之外发布的代码找到命名空间命名约定。

Microsoft guidelines仅对公司编写的代码有帮助。

The general rule for naming namespaces is to use the company name followed by the technology name and optionally the feature and design as follows.

CompanyName.TechnologyName[.Feature][.Design]

但是没有公司的个人怎么办?

在 Java 中,我会使用我个人网站的地址,但在 C# 中,类似 url 的名称空间似乎不受青睐。


这是一个与 namespace naming conventions 略有不同的问题,因为它是关于个人而非公司的命名约定。

恕我直言,如果您将其作为个人发布,我认为最好将其命名为您的 project/program 名称,让我们假设您正在编写一个代号为 "SuperLib" 的库:​​SuperLib.SuperFeature.SuperDesign.

这完全是主观的,但我使用的格式是:

<SolutionName>.<ProjectName>.<FolderName>.<SubfolderName>.<SubSubFolderName>.<etc>

对我来说,至少我发现我的命名空间非常符合我的文件夹结构。

这里有几个例子:

namespace Project.Models.DTO

namespace Project.Domain.Services.Implementations

namespace Project.Controllers