Skip to content

Review naming recommendation for fields #249

Open

Description

@Keboo

Right now our naming standard (Underscore + CamelCase) differs from the more common (Underscore + PascalCase).
Following our guideline is now getting flagged in Visual Studio due to new .editconfig defaults.
https://learn.microsoft.com/dotnet/fundamentals/code-analysis/style-rules/naming-rules#rule-id-ide1006-naming-rule-violation

This can be mitigated by adjusting your editorconfig, but requires someone making a change from the default.

Activity

  1. added
    proposalItems flagged with this are up for discussion to be included in the IntelliTect coding standards
    .editorconfigChanges here are to the editorconfig
    C# coding guidelinesContent related to the C# coding guidelines
    on Feb 16, 2023
  2. ascott18 commented on May 13, 2023

    @ascott18
    Contributor

    Isn't our current standard Underscore + PascalCase? Not Underscore + CamelCase?

    image
    image

  3. ascott18 commented on Jul 17, 2023

    @ascott18
    Contributor
  4. MarkMichaelis commented on Jan 16, 2024

    @MarkMichaelis
    Member

    After discussion, @Keboo and I agree on the following:
    This essentially comes down to whether the advantages of _ outweigh the convention/tradition of _.
    Recommendation:
    State the pros and cons of _ _ case and then leave it to the developer (team) to choose.
    In our coding guidelines (which currently only allow for a one-sentence guideline with no explanation), remove the guideline entirely.

    Thoughts?

  5. Keboo commented on Jan 16, 2024

    @Keboo
    ContributorAuthor

    I think I would change the guidelines to be something like:
    DO: Name all fields consistently, regardless of any field modifiers.

    Specifically looking to call out that we don't think separating naming of things like static, readonly, public, private etc is beneficial.

  6. MarkMichaelis commented on Jan 16, 2024

    @MarkMichaelis
    Member

    Isn't that true for all naming conventions... not just fields?

  7. Keboo commented on Jan 16, 2024

    @Keboo
    ContributorAuthor

    It is, however, fields naming based on modifiers is an area with lots of conflicting information online (including some MS docs) so it may be worth calling out.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Labels

.editorconfigChanges here are to the editorconfigC# coding guidelinesContent related to the C# coding guidelinesproposalItems flagged with this are up for discussion to be included in the IntelliTect coding standards

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions