Code snippet or shortcut to create a constructor in Visual Studio

user467058 picture user467058 · Oct 6, 2010 · Viewed 117.3k times · Source

What is the code snippet or shortcut for creating a constructor in Visual Studio?

Visual Studio 2010 and C#.

Answer

Amra picture Amra · Oct 6, 2010

Type "ctor" + TAB + TAB (hit the Tab key twice). This will create the default constructor for the class you are in:

public MyClass()
{

}

It seems that in some cases you will have to press TAB twice.