dotnet / dotnet/roslynator

"Expand property and add backing field" - Backing field name should match naming rule

Open
#91 2 comments 0 reactions 0 assignees View on GitHub
Area-Refactorings Feature Request
Dominant language
C#
Stars
3.5k
Forks
294
Avg merge
2h 30m
Merged PRs (30d)
4

Description

Visual Studio allows backing fields to be named in a specific manner (Options -> Text Editor -> C# -> Code Style -> Naming -> Specification = Private or Internal field).

When using the "Expand property and add backing field" option, the backing field name should respect the naming convention defined from that menu.

This would match the rename functionality provided by VS itself (IDE1006), and essentially combine the two actions.

example:
Private or Internal field specification is set to Prefix = "m_" with "camel Case Name".
`public Collection MyCollection { get; } = new Collection();`
Use "Expand property and add backing field" action
`private Collection m_myCollection = new Collection();`
`public Collection MyCollection { get { return m_myCollection; } }`

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.