自动生成的基类方法的实现 [英] Automatically generate implementations of base class methods

查看:95
本文介绍了自动生成的基类方法的实现的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

是否有某种在C#中的快捷方式(VS 2008),自动实现在派生类中?


解决方案<虚拟和抽象基类的方法/ DIV>

有关虚拟方法,你可以键入覆盖,然后一个空格。智能感知应为您提供一个选项列表。



有关抽象方法和属性,则可以使用智能标记在基类或接口(也,<大骨节病>控制< /骨节病> + 或<大骨节病>移 + <大骨节病>替代 + <大骨节病> 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屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆