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.Wr
If you are on .NET 3.5 or newer:
Action<string> cw = Console.WriteLine;
cw("Print Something");
C# 6 adds the using static
feature:
using static System.Console;
class Program {
void Main(string[] args) {
WriteLine("Hello, {0}!", "world");
}
}
IntelliSense in Visual Studio 2015 understands this new syntax.