日期:2014-05-17 浏览次数:20861 次
//判断字符串是否为空
string str1 = "MyWord";
if (str1 == "");
Console.Read();
.method private hidebysig static void Main(string[] args) cil managed
{
.entrypoint
// 代码大小 32 (0x20)
.maxstack 2
.locals init ([0] string str1,
[1] bool CS$4$0000)
IL_0000: nop
IL_0001: ldstr "MyWord"
IL_0006: stloc.0
IL_0007: ldloc.0
IL_0008: ldstr ""
IL_000d: call bool [mscorlib]System.String::op_Equality(string,
string)
IL_0012: ldc.i4.0 // 这句话是什么意思呢?
IL_0013: ceq
IL_0015: stloc.1
IL_0016: ldloc.1
IL_0017: brtrue.s IL_0019
IL_0019: call int32 [mscorlib]System.Console::Read()
IL_001e: pop
IL_001f: ret
} // end of method Program::Main