按字母顺序排列或将相似的属性名称分组更好吗?

发布于 2024-10-23 20:28:25 字数 420 浏览 3 评论 0原文

我要问的是,您是否按字母顺序排列您的属性或将它们分组。示例:

分组

Public Property ID As Integer
Public Property CustomerID As Integer
Public Property Address As Address
Public Property Name As Integer

Alpha

Public Property Address As Address
Public Property CustomerID As Integer
Public Property ID As Integer
Public Property Name As Integer

What I am asking is if you alphabetize your properties or group them. Example:

Grouping

Public Property ID As Integer
Public Property CustomerID As Integer
Public Property Address As Address
Public Property Name As Integer

Alpha

Public Property Address As Address
Public Property CustomerID As Integer
Public Property ID As Integer
Public Property Name As Integer

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(3

╰つ倒转 2024-10-30 20:28:25

就它们在代码文件中的物理位置而言?我更喜欢按字母顺序排列,但大多数时候这都不是问题,因为代码编辑器中有一个方便的成员下拉菜单。

In terms of where they physically are in a code file? I prefer alphabetization, but most of the time it's hardly a concern anyways since there is a convenient drop down of members available in the code editor.

飘逸的'云 2024-10-30 20:28:25

我通常按​​组排列属性,而不是按字母顺序排列。例如:

Contact
    ID
    FirstName
    LastName
    Address
    City
    State
    CountryID
    PostalCode

I generally arrange properties in groups, not alphabetically. For instance:

Contact
    ID
    FirstName
    LastName
    Address
    City
    State
    CountryID
    PostalCode
可是我不能没有你 2024-10-30 20:28:25

希望你的班级不会大到足以关心这两种情况。但是,我会按组排列它们(评论每个部分中分组的原因,然后在每个组中按字母顺序排列。

Hopefully your class won't be big enough to care either way. However, I would arrange them by groups (commenting the reason for grouping in each section, then alphabetically within each group.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文