简体   繁体   中英

Quick way to insert interface methods to a class in Visual Studio 2005

I know that in Eclipse, if your class implements an interface or extends an abstract class, there is a quick way to add the method definitions to your class. Can this be done with VS2005? How?

This is language specific but

For C#: Right click on the interface, navigate to Implement Inteface and choose the explicit or implict option. The same menu is available for abstract classes (slightly different name)

There is also a smart tag that will show up on a C# interface / abstract base with the same options. The hot key to get this to popup is "CTRL+."

For VB.Net: Simply hit Enter after the interface name and the methods will be auto-populated.

With your insertion point in the name of the interface, hit Alt-Shift-F10, then enter.

Same thing works to automatically add using statements. (ie. Alt-Shift-F10 is the keyboard command to show that menu the little blue underline thing represents)

Edit: I think this is C#-only -- I rarely use VB.Net

将鼠标悬停在界面名称上,您将获得一个悬停下拉列表,其中包含隐式或显式实现界面的菜单选项。

Right-click the interface name IInterface1

public class Class1 : IInterface1

Select "Implement Interface" from the context menu.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM