Make a shortcut for Console.WriteLine()

前端 未结 14 1434
北恋
北恋 2020-12-23 19:55

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         


        
14条回答
  •  南方客
    南方客 (楼主)
    2020-12-23 20:39

    If you are on .NET 3.5 or newer:

    Action cw = Console.WriteLine;
    
    cw("Print Something");
    

提交回复
热议问题