Resharper string.format shortcut

前端 未结 5 1242
礼貌的吻别
礼貌的吻别 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:50

    Here is an alternate to Matthew's visual studio code snippet. This snippet asks for the variable name but defaults to message which is optional an the only thing required is the variable name. HTH

    Looks like:

    var message = string.Format( "abc {0}", variable ); 
    

    as the default (the abc {0} was the highlighted text)

    
    
      
        
    String Format OmegaMan Surrounded text gets format #SF
    name What the variable name should be. message Vars The target variable for format. variable

提交回复
热议问题