my method
public void Method()
{
OneAction;
}
need format in
Method() => OneAction;
my method
public void Method()
{
OneAction;
}
need format in
Method() => OneAction;
If you can accept manual formatting, you can place the cursor on your method and choose to apply this style to the document/project/solution from the IntelliCode suggestions.
If you insist on formatting when saving files, you can:
Set the Use expression body for methods
item in the C# code style to When possible
Or add csharp_style_expression_bodied_methods = true
to the .editorconfig
file.
Configure a code cleanup profile, adding the Apply expression/block body preferences
item to fixer list.
In the Text Editor > Code Cleanup
options page, select the profile and enable Run Code Cleanup profile on Save