5

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?

1
  • That gives me the abstract class methods which works fine but if that abstract class implements an interface I don’t get the interface properties. abstract class MyAbstract : ImyInterface Oct 14, 2013 at 21:12

1 Answer 1

19

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'

2
  • 2
    CTRL+. will expand the smart tag for you as well.
    – Barryrowe
    May 7, 2014 at 14:59
  • 1
    I believe the default keyboard shortcut to expand the smart tag is ShIFT+ALT+F10. You can customize the keyboard to map it to a different shortcut. I use CTRL+ALT+<.> (Strangely, I tried mapping it to CTRL+<.>, but it didn't work.) -- (Where <.> is the period character).
    – kmote
    Jan 13, 2017 at 21:14

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.