字符串拼接的方法主要包括以下三个:+,String.Format(),StringBuilder.Append()。 1)对于少量固定的字符串拼接,如string s= "a" + "b" + "c",系统会优化成s= String.Concat("a","b","c"),不会新建多个字符串。 如果写成string s="a"; s +="b"; s+="c";则会创建三个新的字符串。 2)Str…
阅读全文C#三种字符串拼接方法性能浅析
Posted: 九月 28, 2011 Under: 编程点滴 By Jian Yun no Comments