Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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. Very convenient.

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

For example,

public class User:ClassA
{
    public User() {}
    public User(string S):base(S) {}
    public User(string S, int I):base(S, I) {}
    ...
}
like image 528
T D Nguyen Avatar asked Dec 28 '25 13:12

T D Nguyen


1 Answers

I do not have ReSharper and it is possible.

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

Enter image description here

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:

  • Application Insights Tools for Visual Studio
  • PowerShell Tools for Visual Studio 2015
  • Productivity Power Tools 2015
  • Snippet Designer
  • Visual Studio Extensibility Templates
like image 129
ehh Avatar answered Dec 31 '25 04:12

ehh



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!