Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
String vs. StringBuilder
Message
Information générale
Forum:
ASP.NET
Catégorie:
Autre
Divers
Thread ID:
00794481
Message ID:
00795351
Vues:
20
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
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform