You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Place members in a well-defined order (AV2406) Maintaining a common order allows other team members to find their way in your code more easily. In general, a source file should be readable from top to bottom, as if reading a book, to prevent readers from having to browse up and down through the code file.
New language features to consider:
local functions
They can be declared anywhere in method bodies (this includes property/event accessors, anonymous methods, lambda expressions and other local functions)
Based on the guidance "a source file should be readable from top to bottom" I think its best to require their declaration at least below its first usage. Example:
Existing rule:
Place members in a well-defined order (AV2406)
Maintaining a common order allows other team members to find their way in your code more easily. In general, a source file should be readable from top to bottom, as if reading a book, to prevent readers from having to browse up and down through the code file.
New language features to consider:
They can be declared anywhere in method bodies (this includes property/event accessors, anonymous methods, lambda expressions and other local functions)
Based on the guidance "a source file should be readable from top to bottom" I think its best to require their declaration at least below its first usage. Example:
But I think the code becomes more readable if they are declared at the end, after all executable code. Example:
The text was updated successfully, but these errors were encountered: