为Console.WriteLine()创建快捷方式 [英] Make a shortcut for Console.WriteLine()

查看:70
本文介绍了为Console.WriteLine()创建快捷方式的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我必须在代码中多次键入Console.WriteLine().是否可以为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");

推荐答案

Visual Studio已为此提供了默认代码段.只需键入 cw 并按 tab .请注意,如果您正在考虑使用一种方法,则该方法可能缺少某些功能,例如自动string.Format和其他重载参数.

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.

这篇关于为Console.WriteLine()创建快捷方式的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆