开发者

MS Visual C#: Eclipse-style autocomplete for interface methods

When implementing interfaces in a class which implements an interface, how can I auto-complete the method signature?

For example, when using Java in Eclipse, I just start typing the name and I see a list of methods which are "missing", an开发者_运维百科d I can also do this by with one mouse click. Is there something similar in Visual Studio Express?


There may be a number of ways to do this, but what I generally do is right-click on the interface in the class declaration (below) and there's an option to "Implement Interface."

public class Class1 : IFace1 // <-- right-click there
{
}

This would create stubbed methods for everything in the interface with NotImplementedExceptions within them.

While it's not free, I also highly recommend ReSharper as a productivity tool for Visual Studio. It makes things like this much quicker and more intuitive (at least in my opinion).


When you declare the class and declare that it implements some abstract method, if you press ALT+SHIFT+F10 a context-menu will pop up and in there is the ability to stub all methods for the interface. Not exactly what you're searching for, but it should solve the problem.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜