在 C# 中自动生成接口实现?
我知道这很懒,但是 Visual C# 2010 Express 有什么方法可以自动生成接口实现吗? (我的意思不是在运行时而是在设计时,就像代码片段一样)。也许使用第三方实用程序?
I know this is quite lazy but, is there any way on Visual C# 2010 Express to auto-generate an interface implementation? (I don't mean at runtime but at design time, like a code snippet). Perhaps with a third party utility?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
我对 Express 不太熟悉,不知道他们是否删除了此功能,但您应该能够右键单击您的
public class MyClass : MyInterface
语句并选择“Implement Inteface”。如果在 Express 中删除了此功能,您始终可以使用 Resharper 来实现此功能。
I'm not familiar with Express enough to know if they removed this feature, but you should just be able to right-click your
public class MyClass : MyInterface
statement and choose "Implement Inteface".If this is removed in Express, you can always use Resharper for this feature.
右键单击接口名称,您应该会看到一个菜单选项“实现接口”或类似的内容。
将光标放在接口名称上时,您还可以按
CTRL + .
来获取相同的上下文菜单和选项。Right click on the interface name, you should see a menu option "Implement Interface" or along those lines.
With the cursor on the interface name, you can also press
CTRL + .
to get the same context menu and options.在 Microsoft Visual Basic 2010 Express 中,我只需将光标放在 Implements 行的末尾并按 Enter 键 - 然后就会自动生成存根,
将光标移动到单词 IMyInterface1 的末尾并按 Enter 键
In Microsoft Visual Basic 2010 Express, I just put the cursor to the end of the Implements line and press Enter - then the stubs are generated automatically
move the cursor to the end of the word IMyInterface1 and press Enter