字符串声明" A" +" B" vs" AB"

时间:2015-02-03 15:00:20

标签: c# string

而不是

string someString = "AB";

我偶然发现了

string someString = "A" + "B";

是否有任何技术解释使第二种方式更有利?

1 个答案:

答案 0 :(得分:6)

var answer = "The only thing advantageous is readability, if you have large " +
             "amounts of text it can be useful to break up the text inside the " +
             "source code for better readability. The compiler will turn it " +
             "in to a single string at compile time anyway";