有谁能提供一个方法,用于删除单行语句中的花括号?(不包括手动删除花括号这种显而易见的方式)
使用Visual Studio中的C#。
因此,代码不再是这样:
if (thingy is null)
{
throw new ArgumentNullException(nameof(thingy));
}
提供备选方案:
if (thingy is null)
throw new ArgumentNullException(nameof(thingy));
我已经尝试运行CodeMaid并更改CodeCleanup(只是将其改回了括号格式)。 我很乐意尝试任何推荐的扩展等来解决这个问题。
.editorconfig
文件中使用csharp_prefer_braces = false
来设置这个选项:https://learn.microsoft.com/en-us/visualstudio/ide/editorconfig-language-conventions?view=vs-2019#code-block-preferences - canton7if (tingy is null) {DoStuff();...}
- Honduriel