dotnet/roslyn
Add an option for c# override generation (ignoring expression bodied members)
開放
#38,514 建立於 2019年9月5日
Area-IDEDeveloper CommunityIDE-CodeStylehelp wanted
倉庫指標
- 星標
- (20,414 顆星)
- PR 合併指標
- (PR 指標待抓取)
描述
This issue has been moved from a ticket on Developer Community.
when override SomeVirtualOrAbstractMethod is expanded, and
Options->Text Editor->C#->Code Style->Use expression body for methods is set to "When on single line", the generated piece of code looks like this:
protected override SomeVirtualOrAbstractMethod() => base. SomeVirtualOrAbstractMethod();
this is (in most cases) not wanted, since the reason to override a method is to add custom behaviour (and usually also call the base class)
Thus the suggestion should be that an option is added to explicitely have the override expansion generated normal member bodies, generating this code:
protected override SomeVirtualOrAbstractMethod()
{
base. SomeVirtualOrAbstractMethod();
}