Hi Guys, I myself have been having this same question and this question triggered me to investigate into it a bit,
I create the following class
public class Class1
{
string str = "One" + "Team";
string str2 = string.Concat("One", "Team");
}
And below is corresponding IL code for that.
.method public hidebysig specialname
rtspecialname
instance void .ctor() cil managed { // Code size 40
(0x28) .maxstack 8
IL_0000: ldarg.0
IL_0001: ldstr "OneTeam"
IL_0006: stfld string StringConcat.Class1::str
IL_000b: ldarg.0
IL_000c: ldstr "One" IL_0011: ldstr "Team"
IL_0016: call string [mscorlib]System.String::Concat(string, string)
IL_001b: stfld string StringConcat.Class1::str2
IL_0020: ldarg.0
IL_0021: call instance void[mscorlib]System.Object::.ctor()
IL_0026: nop IL_0027: ret } // end of method Class1::.ctor
For me it definitely looks like string.Concat is having more steps than overloaded + operator. But I know for sure inside the system.string class there will be similer set of operations happening for overloaded + operator as well. Thoughts?