Resharper string.format shortcut

前端 未结 5 1110
礼貌的吻别
礼貌的吻别 2021-01-13 04:04

I often find myself writing

var message = \"Hello {0}\";

and then going back and typing in

var message = string.Format(\"He         


        
5条回答
  •  有刺的猬
    2021-01-13 04:46

    I ended up writing an extension method for strings named FormatWith(arg0, ar1...) because of this. Then I found that the Humanizer library did the same exact thing. Add the Humanizer NuGet package and now you'll be able to write "Heres my formatted string on the {0}st try!".FormatWith(1)" with hopefully less bouncing around. If you have ReSharper and like that it highlights the matching placemarkers with the parameter, install the Humanizer Annotations R# Extension and you'll get them back.

提交回复
热议问题