[英]Shortcut for creating constructor with base (C# Visual Studio 2015)
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. 在Visual Studio C#中,您可以在一个类中键入
ctor
,然后按Tab键 ,Visual Studio将为我为该类创建一个构造函数。 Very convenient. 很方便。
But is there a way (shortcut) to make Visual Studio generate all constructors with bases from its inherited class? 但是,是否有一种方法(快捷方式)可以使Visual Studio从其继承的类生成具有基数的所有构造函数?
For example, 例如,
public class User:ClassA
{
public User() {}
public User(string S):base(S) {}
public User(string S, int I):base(S, I) {}
...
}
I do not have ReSharper and it is possible. 我没有ReSharper,这是可能的。
You can select your base class and press Shift + Alt + F10 and select Generate All : 您可以选择您的基类,然后按Shift + Alt + F10并选择Generate All :
I am not sure if it comes with the Visual Studio 2015 installation; 我不确定它是否随Visual Studio 2015安装一起提供。 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: 按照我安装的扩展程序,可能是不错的选择:
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.