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?
Asked
Active
Viewed 2.3k times
21
-
9I wouldn't say this is lazy at all. Taking out monotonous tasks like this makes you a more productive (and therefore better) programmer. – womp Aug 10 '10 at 17:48
-
@jsoldi do you mean interface implementation or interface? The answers you have been given seem to tell you how to generate an interface FROM an implementation rather than an interface implementation. – Caltor Feb 08 '12 at 18:49
3 Answers
30
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.

womp
- 115,835
- 26
- 236
- 269
-
5
-
-
Nothing wrong with the Express versions for the less than professional coders amongst us. :) – Andy Aug 10 '10 at 20:37
-
@womp I think the OP is actually asking if there is a way to add the interface members to an existing class, which I would also like to know as I can't see a way to do it even in Professional. You have rather nicely explained how to generate the interface from the class which although useful and correct is actually the inverse of the question asked. – Caltor Feb 08 '12 at 13:57
-
I'm using Visual Studio Enterprise 2017, Version 15.3.3, and I managed to find this option by: Right Clicking on the `MyInterface` -> Quick Actions and Refactorings. – Tyler May 04 '18 at 11:57
16
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.

Babak Naffas
- 12,395
- 3
- 34
- 49
1
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
Public Class Class1
Implements IMyInterface1
move the cursor to the end of the word IMyInterface1 and press Enter

TmTron
- 17,012
- 10
- 94
- 142