gpt4 book ai didi

.net - String.Format与“字符串” +“字符串”还是StringBuilder?

转载 作者:行者123 更新时间:2023-12-03 14:05:32 30 4
gpt4 key购买 nike

Possible Duplicates:
Is String.Format as efficient as StringBuilder
C# String output: format or concat?


性能优先级是什么?应优先选择以下各项的条件是什么:

String.Format("{0}, {1}", city, state);


要么

city + ", " + state;


要么

StringBuilder sb = new StringBuilder();
sb.Append(city);
sb.Append(", ");
sb.Append(state);
sb.ToString();

30 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com