使用基础创建构造函数的快捷方式(C#Visual Studio 2015) [英] Shortcut for creating constructor with base (C# Visual Studio 2015)

查看:380
本文介绍了使用基础创建构造函数的快捷方式(C#Visual Studio 2015)的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在Visual Studio C#中,您可以在一个类中键入ctor,然后按 Tab ,Visual Studio将为我为该类创建一个构造函数.非常方便.

In Visual Studio C# you can, in a class, type ctor and then press Tab and Visual Studio will create a constructor for that class for me. Very convenient.

但是有没有一种方法(快捷方式)可以使Visual Studio从其继承的类中生成具有基数的所有构造函数?

But is there a way (shortcut) to make Visual Studio generate all constructors with bases from its inherited class?

例如,

public class User:ClassA
{
    public User() {}
    public User(string S):base(S) {}
    public User(string S, int I):base(S, I) {}
    ...
}

推荐答案

我没有ReSharper,并且有可能.

I do not have ReSharper and it is possible.

您可以选择您的基类,然后按 Shift + Alt + F10 并选择 Generate All :

You can select your base class and press Shift + Alt + F10 and select Generate All:

我不确定Visual Studio 2015附带了它吗?也许您需要添加扩展名.我不确定是否需要其中之一.

I am not sure if it comes with the Visual Studio 2015 installation; maybe you need to add an extension. I am not sure which one of them it is required.

以下是我安装的扩展程序,这些扩展程序可能是不错的选择:

Following the extensions I have installed that maybe good candidates:

  • Visual Studio的Application Insights工具
  • 用于Visual Studio 2015的PowerShell工具
  • 2015年生产力电动工具
  • 片段设计器
  • Visual Studio扩展性模板

这篇关于使用基础创建构造函数的快捷方式(C#Visual Studio 2015)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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