Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

visual studio 2012 shortcut to implement interface

It appears that Visual Studio 2012 has removed the automatic implementation of abstract classes that inherit from an interface, any idea how to fix this in 2012 version?

like image 727
user2146538 Avatar asked Oct 14 '13 20:10

user2146538


People also ask

What does ctrl t'do in Visual Studio?

Ctrl + T to show class.

How do you open the implementation method in Visual Studio?

Navigate to implementation of a type or a type memberChoose Navigate | Go To Implementation in the main menu, press Ctrl+F12 , or click the symbol while holding Ctrl+Alt keys. Note that in Visual Studio 2017 and later, the Ctrl+Alt -click is used for adding multiple carets.


1 Answers

It seems to still be possible. Please see this How To article from MSDN

I tested it and it seems to work just fine.

StringComparer

new implementation after clicking

Use this procedure to perform the Implement Abstract Base Class IntelliSense operation. For more information, see Implement Abstract Base Class. To implement an abstract base class using IntelliSense

  1. Create a console application.
  2. Place the cursor after the class Program statement.
  3. Type : StringComparer so the class declaration becomes class Program : StringComparer.
  4. Click the smart tag under StringComparer, and click Implement abstract class 'System.StringComparer'. IntelliSense adds three override methods from the StringComparer class to the Program class.

I created an interface IModelBase

namespace VendorPrototype.Model
{
    interface IModelBase
    {
        int ID();
        DateTime CreatedDate();
        String CreatedBy();
        DateTime LastModifiedDate();
        String LastModifiedBy();
    }
}

and a class ModelBase

abstract class ModelBase : IModelBase
{
}

When I clicked IModelBase and hovered under it, I was able to see the menu.

Implement interface 'IModelBase'

like image 117
kush Avatar answered Oct 10 '22 09:10

kush