tema: How to... C#
Prikaz jedne poruke
Stara 7.11.2009, 10:28   #17
MG-RAY
Starosedelac
 
Član od: 15.2.2006.
Lokacija: Midlands
Poruke: 1.523
Zahvalnice: 277
Zahvaljeno 307 puta na 207 poruka
Slanje poruke preko Skypea korisniku MG-RAY
Određen forumom Re: How to...C#

Pa, zavisi, ako u nekoj buducnost budes imao CLI na svakoj platformi, onda ce biti nezavisan.

.NET prefektno radi, za sada, jedino na windowsu. Pogledaj MONO (Linux, BSD, UNIX, Mac OS X, Solaris ) za ostale.

Sto se samog IL-a tice, nije nesto previse komplikovano, pogledaj recimo ovo:

Kod:
.method private hidebysig static void  Main(string[] args) cil managed
{
  .entrypoint
  // Code size       235 (0xeb)
  .maxstack  4
  .locals init ([0] string[] list,
           [1] class [mscorlib]System.Collections.Generic.IEnumerable`1<string> query,
           [2] string s,
           [3] string[] CS$0$0000,
           [4] class [mscorlib]System.Collections.Generic.IEnumerator`1<string> CS$5$0001,
           [5] bool CS$4$0002)
  IL_0000:  nop
  IL_0001:  ldc.i4.s   10
  IL_0003:  newarr     [mscorlib]System.String
  IL_0008:  stloc.3
  IL_0009:  ldloc.3
  IL_000a:  ldc.i4.0
  IL_000b:  ldstr      "STACK"
  IL_0010:  stelem.ref
  IL_0011:  ldloc.3
  IL_0012:  ldc.i4.1
  IL_0013:  ldstr      "IS"
  IL_0018:  stelem.ref
  IL_0019:  ldloc.3
  IL_001a:  ldc.i4.2
  IL_001b:  ldstr      "OUT "
  IL_0020:  stelem.ref
  IL_0021:  ldloc.3
  IL_0022:  ldc.i4.3
  IL_0023:  ldstr      " OF"
  IL_0028:  stelem.ref
  IL_0029:  ldloc.3
  IL_002a:  ldc.i4.4
  IL_002b:  ldstr      "ORDER"
  IL_0030:  stelem.ref
  IL_0031:  ldloc.3
  IL_0032:  ldc.i4.5
  IL_0033:  ldstr      "UBERM"
  IL_0038:  stelem.ref
  IL_0039:  ldloc.3
  IL_003a:  ldc.i4.6
  IL_003b:  ldstr      " SOLVER"
  IL_0040:  stelem.ref
  IL_0041:  ldloc.3
  IL_0042:  ldc.i4.7
  IL_0043:  ldstr      "OF"
  IL_0048:  stelem.ref
  IL_0049:  ldloc.3
  IL_004a:  ldc.i4.8
  IL_004b:  ldstr      "UNNILATERAL"
  IL_0050:  stelem.ref
  IL_0051:  ldloc.3
  IL_0052:  ldc.i4.s   9
  IL_0054:  ldstr      "EMPIRES"
  IL_0059:  stelem.ref
  IL_005a:  ldloc.3
  IL_005b:  stloc.0
  IL_005c:  ldloc.0
  IL_005d:  ldsfld     class [System.Core]System.Func`2<string,bool> Program.Program::'CS$<>9__CachedAnonymousMethodDelegate2'
  IL_0062:  brtrue.s   IL_0077
  IL_0064:  ldnull
  IL_0065:  ldftn      bool Program.Program::'<Main>b__0'(string)
  IL_006b:  newobj     instance void class [System.Core]System.Func`2<string,bool>::.ctor(object,
                                                                                          native int)
  IL_0070:  stsfld     class [System.Core]System.Func`2<string,bool> Program.Program::'CS$<>9__CachedAnonymousMethodDelegate2'
  IL_0075:  br.s       IL_0077
  IL_0077:  ldsfld     class [System.Core]System.Func`2<string,bool> Program.Program::'CS$<>9__CachedAnonymousMethodDelegate2'
  IL_007c:  call       class [mscorlib]System.Collections.Generic.IEnumerable`1<!!0> [System.Core]System.Linq.Enumerable::Where<string>(class [mscorlib]System.Collections.Generic.IEnumerable`1<!!0>,
                                                                                                                                        class [System.Core]System.Func`2<!!0,bool>)
  IL_0081:  ldsfld     class [System.Core]System.Func`2<string,string> Program.Program::'CS$<>9__CachedAnonymousMethodDelegate3'
  IL_0086:  brtrue.s   IL_009b
  IL_0088:  ldnull
  IL_0089:  ldftn      string Program.Program::'<Main>b__1'(string)
  IL_008f:  newobj     instance void class [System.Core]System.Func`2<string,string>::.ctor(object,
                                                                                            native int)
  IL_0094:  stsfld     class [System.Core]System.Func`2<string,string> Program.Program::'CS$<>9__CachedAnonymousMethodDelegate3'
  IL_0099:  br.s       IL_009b
  IL_009b:  ldsfld     class [System.Core]System.Func`2<string,string> Program.Program::'CS$<>9__CachedAnonymousMethodDelegate3'
  IL_00a0:  call       class [mscorlib]System.Collections.Generic.IEnumerable`1<!!1> [System.Core]System.Linq.Enumerable::Select<string,string>(class [mscorlib]System.Collections.Generic.IEnumerable`1<!!0>,
                                                                                                                                                class [System.Core]System.Func`2<!!0,!!1>)
  IL_00a5:  stloc.1
  IL_00a6:  nop
  IL_00a7:  ldloc.1
  IL_00a8:  callvirt   instance class [mscorlib]System.Collections.Generic.IEnumerator`1<!0> class [mscorlib]System.Collections.Generic.IEnumerable`1<string>::GetEnumerator()
  IL_00ad:  stloc.s    CS$5$0001
  .try
  {
    IL_00af:  br.s       IL_00c0
    IL_00b1:  ldloc.s    CS$5$0001
    IL_00b3:  callvirt   instance !0 class [mscorlib]System.Collections.Generic.IEnumerator`1<string>::get_Current()
    IL_00b8:  stloc.2
    IL_00b9:  ldloc.2
    IL_00ba:  call       void [mscorlib]System.Console::Write(string)
    IL_00bf:  nop
    IL_00c0:  ldloc.s    CS$5$0001
    IL_00c2:  callvirt   instance bool [mscorlib]System.Collections.IEnumerator::MoveNext()
    IL_00c7:  stloc.s    CS$4$0002
    IL_00c9:  ldloc.s    CS$4$0002
    IL_00cb:  brtrue.s   IL_00b1
    IL_00cd:  leave.s    IL_00e3
  }  // end .try
  finally
  {
    IL_00cf:  ldloc.s    CS$5$0001
    IL_00d1:  ldnull
    IL_00d2:  ceq
    IL_00d4:  stloc.s    CS$4$0002
    IL_00d6:  ldloc.s    CS$4$0002
    IL_00d8:  brtrue.s   IL_00e2
    IL_00da:  ldloc.s    CS$5$0001
    IL_00dc:  callvirt   instance void [mscorlib]System.IDisposable::Dispose()
    IL_00e1:  nop
    IL_00e2:  endfinally
  }  // end handler
  IL_00e3:  nop
  IL_00e4:  call       int32 [mscorlib]System.Console::Read()
  IL_00e9:  pop
  IL_00ea:  ret
} // end of method Program::Main
To je IL kod onoga sto sam napisao ranije. Kada pokrenes .NET aplikaciju, ovaj kod se salje CLR-u na kompajliranje.

Poslednja ispravka: MG-RAY (7.11.2009 u 10:38)
MG-RAY je offline   Odgovor sa citatom ove poruke