// C# 代碼
string s = "hi";
string t = s + "bye";
Console.WriteLine(t);
IL 步驟:
ldstr "hi" stloc.0 (V_0)ldloc.0 ldstr "bye" call String.Concat stloc.1 (V_1)ldloc.1 call WriteLinestring a = "bye";
string b = "bye";
Console.WriteLine(a == b);
IL:ldstr "bye" 兩次,call String.Equals,call WriteLine(bool)。輸出 True。
String.Concatadd 指令編譯器根據運算元類型決定映射目標。