Search code examples
c#visual-studioconstructorcode-snippetsshortcut

Code snippet or shortcut to create a constructor in Visual Studio


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

Visual Studio 2010 and C#.


Solution

  • 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.