按字母顺序排列或将相似的属性名称分组更好吗?
我要问的是,您是否按字母顺序排列您的属性或将它们分组。示例:
分组
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 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
就它们在代码文件中的物理位置而言?我更喜欢按字母顺序排列,但大多数时候这都不是问题,因为代码编辑器中有一个方便的成员下拉菜单。
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.
我通常按组排列属性,而不是按字母顺序排列。例如:
I generally arrange properties in groups, not alphabetically. For instance:
希望你的班级不会大到足以关心这两种情况。但是,我会按组排列它们(评论每个部分中分组的原因,然后在每个组中按字母顺序排列。
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.