Search code examples
c#.net

Make a shortcut for Console.WriteLine()


I have to type Console.WriteLine() many times in my code. Is it possible to create a shortcut for Console.WriteLine so that I can use it like...

CW=Console.WriteLine();
// After that, I can use this CW for my Console.WriteLine() like
CW("Print Something");

Solution

  • Visual Studio already has a default code snippet for this. Just type cw and press tab. Note that if you're considering using a method, it may lack some features like the automatic string.Format and other overloaded parameters.