Open richayrich opened 7 years ago
As far as I know, it is not possible to access these code style settings from third party tools such as Roslynator.
Actually, it's doable. Visual Studio provides the DTE object which lets you access the options on the Options dialog box.
See https://msdn.microsoft.com/en-us/library/bb165648(v=vs.140).aspx
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<MyClass> MyCollection { get; } = new Collection<MyClass>();
Use "Expand property and add backing field" actionprivate Collection<MyClass> m_myCollection = new Collection<MyClass>();
public Collection<MyClass> MyCollection { get { return m_myCollection; } }