Listing 1
.assembly Hello {}
.method static void HelloWorld()
{
.entrypoint
ldstr "Hello World."
call void [mscorlib]System.Console::WriteLine(class System.String)
ret
}
Listing 2
.assembly Hello{}
.method static void HelloWorld()
{
.entrypoint
ldstr "hello "
stloc.0
ldstr "world "
stloc.1
ldloc.0
ldloc.1
call string [mscorlib]System.String::Concat(string,string)
stloc.2
ldloc.2
call void [mscorlib]System.Console::WriteLine(class System.String)
ret
}
Listing 3
.assembly Sales{}
.method static void Sales()
{
.entrypoint
.locals init ([0] int32 iSales,
[1] int32 iReturns,
[2] int32 iNet,
[3] string a,
[4] string b)
ldstr "Total Sales For Today\?"
call void [mscorlib]System.Console::WriteLine(string)
call string [mscorlib]System.Console::ReadLine()
stloc.3
ldstr "\nTotal Returns For Today\?"
call void [mscorlib]System.Console::WriteLine(string)
call string [mscorlib]System.Console::ReadLine()
stloc.s b
ldloc.3
call int32 [mscorlib]System.Int32::Parse(string)
stloc.0
ldloc.s b
call int32 [mscorlib]System.Int32::Parse(string)
stloc.1
ldloc.0
ldloc.1
sub
stloc.2
ldloc.2
ldc.i4.s 10
ble.s IL_0045
IL_0039: ldstr "You had a great day!"
IL_003e: call void [mscorlib]System.Console::WriteLine(string)
IL_0043: br.s IL_004f
IL_0045: ldstr "Better luck tomorrow."
IL_004a: call void [mscorlib]System.Console::WriteLine(string)
IL_004f: ret
}