Hiren Kagrana
Hiren Kagrana

Reputation: 932

Implement auto code structure with visual studio

I am using VS2013 for development. I want to implement such functionality that automatically write a method structure while I just write a method name with parameter and press TAB.

For example: when I write public void testMethod(string param) and press TAB, visual studio automatically writes the TRY, CATCH and FINALLY block and my method look like below:

public void testMethod(string param)
{
    try
    {

    }
    catch
    {

    }
    finally
    {

    }
}

I have googled for this but get no success, I have no idea how to achieve this task, Please guide me for the same.

Upvotes: 0

Views: 197

Answers (2)

Sajeetharan
Sajeetharan

Reputation: 222682

You could use the Code Snippet

Here is a similar question: How to store reusable code

Upvotes: 2

Julien Roncaglia
Julien Roncaglia

Reputation: 17837

Visual Studio Code Snippets available when you type anything in the IDE an when you use Ctrl+K, X could also be a solution (They are harder to create than simple text snippets but the experience is better in the IDE with direct auto completion)

Or you could get a ReSharper license and obtain the best of both world (And thousand of must-have features)

Upvotes: 3

Related Questions