自动生成的基类方法的实现 [英] Automatically generate implementations of base class methods
问题描述
是否有某种在C#中的快捷方式(VS 2008),自动实现在派生类中?
有关虚拟方法,你可以键入覆盖
,然后一个空格。智能感知应为您提供一个选项列表。
有关抽象方法和属性,则可以使用智能标记在基类或接口(也,<大骨节病>控制< /骨节病> + 或<大骨节病>移骨节病> + <大骨节病>替代骨节病> + <大骨节病> F10 骨节病>将显示智能标记菜单)生成具体项目。
例如,在下面的代码片段,您可以放置插入符的 INotifyPropertyChanged的
的结束和按<大骨节病>控制骨节病> + 可再选择实现接口,以及的PropertyChanged
事件将被添加到 MyClass的
:
MyClass类:INotifyPropertyChanged的
{
}
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?
For virtual methods, you can type override
and then a space. Intellisense should offer you a list of options.
For abstract methods and properties, you can use the smart tag on the base class or interface (also, Ctrl+. or Shift+Alt+F10 will show the smart tag menu) to generate the concrete items.
For example, in the following code snippet, you could place the caret at the end of INotifyPropertyChanged
and press Ctrl+. to then select Implement Interface, and the PropertyChanged
event would be added to MyClass
:
class MyClass : INotifyPropertyChanged
{
}
这篇关于自动生成的基类方法的实现的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!