visual studio 2012 shortcut to implement interface

可紊 提交于 2019-12-22 08:00:03

问题


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:


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

I tested it and it seems to work just fine.

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.



来源:https://stackoverflow.com/questions/19369048/visual-studio-2012-shortcut-to-implement-interface

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!