String.Format vs “string” + “string” or StringBuilder? [duplicate]
问题 This question already has answers here : Closed 10 years ago . Possible Duplicates: Is String.Format as efficient as StringBuilder C# String output: format or concat? What is the performance priority and what should be the conditions to prefer each of the following: String.Format("{0}, {1}", city, state); or city + ", " + state; or StringBuilder sb = new StringBuilder(); sb.Append(city); sb.Append(", "); sb.Append(state); sb.ToString(); 回答1: Compiler will optimize as much string concat as it