Visual Studio 2012实施界面的快捷方式 [英] visual studio 2012 shortcut to implement interface

查看:156
本文介绍了Visual Studio 2012实施界面的快捷方式的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

似乎Visual Studio 2012删除了从接口继承的抽象类的自动实现,您知道如何在2012版本中解决此问题吗?

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?

推荐答案

似乎仍然可行.请参阅此如何从MSDN文章

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

我对其进行了测试,它似乎可以正常工作.

I tested it and it seems to work just fine.

使用此过程执行实现抽象基类 IntelliSense操作.有关更多信息,请参见实现摘要. 基类.使用IntelliSense实现抽象基类

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. 创建控制台应用程序.
  2. 将光标置于class Program语句之后.
  3. 键入: StringComparer,使类声明变为class Program : StringComparer.
  4. 单击StringComparer下的智能标记,然后单击实现抽象类'System.StringComparer". IntelliSense将三个覆盖方法从StringComparer类添加到Program类.
  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.

我创建了一个界面IModelBase

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

和一个类ModelBase

abstract class ModelBase : IModelBase
{
}

当我单击IModelBase并悬停在其下时,可以看到菜单.

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

这篇关于Visual Studio 2012实施界面的快捷方式的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆