gpt4 book ai didi

editor - 使用 'Block Body' 时,Visual Studio 可以使用 'Generate Method' ,但还是更喜欢 'Expression Body' 吗? (VS2019)

转载 作者:行者123 更新时间:2023-12-04 12:59:26 25 4
gpt4 key购买 nike

I use 'Generate Method' a lot (when typing a missing method call, Visual Studio offers to generate it), but when the options are set to prefer an Expression Body, it generates an Expression Body like this:

private void Blah() => throw new NotImplementedException();

然后我必须将其转换为块体,因为大多数方法都不是一行。有什么方法可以让 Visual Studio 生成块体方法但仍然建议表达式体方法?

最佳答案

I then have to convert it to a block body because most methods aren't one line. Is there any way to get Visual Studio to generate block body methods but still suggest expression body methods?



解决方案

请更改此:
Tools --> Options --> Text Editor --> C# --> Code Style --> Expression Preferences -->

偏好 Use expression body for methods从不

enter image description here

希望能帮到你。

关于editor - 使用 'Block Body' 时,Visual Studio 可以使用 'Generate Method' ,但还是更喜欢 'Expression Body' 吗? (VS2019),我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/60547628/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com