Best way to break long strings in C# source code

后端 未结 10 1486
伪装坚强ぢ
伪装坚强ぢ 2021-02-03 18:47

I am wondering what is the \"best practice\" to break long strings in C# source code. Is this string

\"string1\"+
\"string2\"+
\"string3\"

con

10条回答
  •  终归单人心
    2021-02-03 19:41

    Your example will be concatenated at compile time. All inline strings and const string variables are concatenated at compile time.

    Something to keep in mind is that including any readonly strings will delay concatting to runtime. string.Empty and Environment.NewLine are both readonly string variables.

提交回复
热议问题