How can I type “{0}” more quickly in Visual Studio?

前端 未结 2 832
伪装坚强ぢ
伪装坚强ぢ 2021-01-29 13:58

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\'

2条回答
  •  一整个雨季
    2021-01-29 15:00

    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}";
    

提交回复
热议问题