Automatically generate implementations of base class methods

后端 未结 7 816
我在风中等你
我在风中等你 2021-02-02 07:33

Is there a shortcut of some kind in C# (VS 2008) to automatically implement the virtual and abstract base class methods in a derived class?

7条回答
  •  北海茫月
    2021-02-02 08:28

    As the others have mentioned, the smart tag (via Ctrl+. and Alt+Shft+F10) will solve your problem, however Visual Studio has an annoying option that will automatically wrap the generated properties/methods with a region like this:

    #region INotifyPropertyChanged members
    ...
    #endregion
    

    You can turn this functionality by going to Tools > Options > Text Editor > C# > Advanced. There is a checkbox called Implement Interface > Surround generated code with #region. Just make sure it is unchecked.

提交回复
热议问题