Is it better to alphabetize or group similar property names?
What I am asking is if you alphabetize your properties or group them. Example:
Grouping开发者_Python百科
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
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:
Contact
ID
FirstName
LastName
Address
City
State
CountryID
PostalCode
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.
精彩评论