editorconfig - how to specify underscore prefix for readonly private fields? [duplicate]
Asked Answered
J

1

14

I haven't been able to find anything on this online.

Is there any way to specify that an underscore prefix for readonly private fields should be added?

Ever since I started using an editorconfig file, Visual Studio will PascalCase the field when I choose the "Introduce read-only field" action.

This is the action I am choosing

Jorgensen answered 18/12, 2019 at 13:55 Comment(3)
I found this on another answer... Not sure if it is helpful dotnet_naming_style.private_prefix_style.required_prefix = _Thrown
Can you try the solution in this post? <br> #45737159Marjoriemarjory
Did you have any update for this issue? First of all, I agree with Sebastian's idea and VS can customize naming rules and include prefixes. You can go to Tools-->Options-->Text Editor-->C#(if you are using C#)-->Code Style-->Naming to add a new rule.You can refer to that document for details.Licit
J
10

The answer here solved my issue, as linked by Sebastian Brunner in the comments:

https://mcmap.net/q/117675/-how-do-i-customize-visual-studio-39-s-private-field-generation-shortcut-for-constructors

Jorgensen answered 19/12, 2019 at 15:11 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.