Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
String vs. StringBuilder
Message
General information
Forum:
ASP.NET
Category:
Other
Miscellaneous
Thread ID:
00794481
Message ID:
00795351
Views:
19
Interesting. .NET defines an overload for String.Concat that takes up to 4 string parameters so as long as you are concatenating 4 strings it will use concat(string,string,string,string). As soon as you concat the fifth string it switches to creating an array of strings and calling System.String::Concat(string[]) so there will be some overhead to creating and enumerating the array when you have more than 4 parameters.


>And we pretty much verified this by creating a couple of functions that assign strings in a single statement and then assign multiple strings to the same variable through multiple assignment statements, then looked at the low level code using ILDASM. In the single assignment statement the overloaded function Concat is called once with multiple string arguments while in the second case Concat is called multiple times. Interesting.
>
>Bill
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform