Dmitresky
Dmitresky

Reputation: 586

how to automate a lot of repetitive actions in Visual Studio 2012?

How to automate a lot of repetitive actions in Visual Studio 2012? Need to convert synchronic methods to async. For example, need to do from

public void SomeMethod(String something)
{
     //action
}
public Some SomeMethodOneMore(String something)
{
    //action
}

to

public async Task SomeMethodAsync(String something)
{
     //action
}
public async Task<Some> SomeMethodOneMoreAsync(String something)
{
    //action
}

Upvotes: 3

Views: 224

Answers (2)

griegs
griegs

Reputation: 22770

I am assuming that the methods already have code in them, so in that vein, I don't think there is one single way.

In the past I have highlighted the common bit of code and simply done a manual find and replace. It's slow and painful.

Upvotes: 2

shamp00
shamp00

Reputation: 11326

For your type of work, you can get an awful lot done with careful use of SublimeText's multiple cursors. See this video demonstration.

In Visual Studio I have 'Open with SublimeText' defined as an External Tool with a keyboard shortcut for Alt+O. Then whenever I need the multiple cursor functionality I can switch to it quickly.

The same functionality is also available as a free extension for visual studio. See Scott Hanselman's writeup

Upvotes: 1

Related Questions