Is there a difference between :
StringBuilder requete = new StringBuilder();
requete.Append(" INSERT into " + listeLibelleTable[index] + " ( ");
and
StringBuilder requete = new StringBuilder();
requete.Append(" INSERT into ");
requete.Append(listeLibelleTable[index]);
requete.Append(" ( ");
When I say “difference” I mean in terms of performance, if this code is in a loop for example.
I think these line
requete.Append(" INSERT into " + listeLibelleTable[index] + " ( ");
is resolved at compile time so It should not be any impact in terms of performance but I’m not sure of that
Unless
listeLibelleTable[index]can indeed be resolved at compile time (which I greatly doubt), using the string concatenation seems to be counter productive to the use of theStringBuilder.In your second example you are concatenating a string and then appending it instead of appending to the
StringBuilder.In either case, you should probably use
AppendFormatfor readability: