I would like to create a refactor or template in Visual Studio 2022 to wrap some code easily with my custom code. For example if I have the function like this
void MyFunc()
{
DoSomething();
}
I would like to be able to select the DoSomething(), click refactor and then it converts it to.
void MyFunc()
{
try
{
DoSomething();
} catch {
// Handle error
}
}
Is there an easy way to setup a template like this?