Given a statement on a single line (line 42) like:

Add(1, 2);

that I want to transform to

Console.WriteLine(Add(1, 2));

my current workflow is to press Ctrl-G 42 Enter Shift-End LeftArrow Ctrl-X c w Tab Tab Ctrl-V End Backspace Backspace. Surely there must be a faster way?

  • VSCode or regular Visua Studio? I know both support regex replace, which is likely what you'd want to use. I'd imagine you have at least a couple dozen of these statements you'd want to change? – Sam Forbis May 13 at 15:02
  • I'm fine with using both. I'm familiar with regexes and don't have an immediate need to replace many instances now, but the need to wrap statements with Console.WriteLine or other function call snippets does come up often enough for me that I'd like to do that more quickly.. – rubystallion May 13 at 15:17

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.