我如何键入"{0}"?在Visual Studio中更快? [英] How can I type "{0}" more quickly in Visual Studio?

查看:144
本文介绍了我如何键入"{0}"?在Visual Studio中更快?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在C#中,用 Console.WriteLine() .考虑到它的频率,它是一组笨拙的按键.但是尽管进行了搜索,但我找不到任何速记或热键来自动将其插入Visual Studio.有没有人想出一些办法来加快这个过程?

In C#, it's common to have to type {0}, {1}, etc. when formatting strings with string.Format() or Console.WriteLine(). Considering its frequency, it's an awkward set of key strokes. But despite my searches, I couldn't find any sort of shorthand or hotkey to automatically insert it in Visual Studio. Has anyone figured out something to expedite the process?

推荐答案

您可以使用我的

You can create the following command (C#) with my Visual Commander extension to insert text and then assign a keyboard shortcut to it:

    EnvDTE.TextSelection ts = DTE.ActiveDocument.Selection as EnvDTE.TextSelection;
    ts.Text = "{0}";

这篇关于我如何键入"{0}"?在Visual Studio中更快?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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