Mono's (g)mcs produces different metadata for explicitly-implemented interface members than CSC does. Thus, a question:
Should these differences be considered to be Mono bugs? Details: Consider explicitly implemented methods and properties: using System.Collections; using System.Collections.Generic; class Demo : IEnumerator, IEnumerator<Demo>, IEnumerable<Demo>, IEnumerable { /* ... unimportant ... */ // explicitly implemented interface members object IEnumerator.Current { get { return null; } } Demo IEnumerator<Demo>.Current { get { return null; } } IEnumerator IEnumerable.GetEnumerator () { return null; } IEnumerator<Demo> IEnumerable<Demo>.GetEnumerator () { return null; } } There are two significant differences between Mono's behavior and .NET's behavior. 1. Property names: (g)mcs generates TypeName.MemberName, while CSC produces Namespace.TypeName.MemberName, e.g. IEnumerator.Current vs. System.Collections.IEnumerator.Current. Oddly, (g)mcs generates Namespace.TypeName.MemberName for methods; it's only properties that get abbreviated in this fashion. 2. Generics: gmcs produces significantly different member names compared to CSC: gmcs: System.Collections.Generic.IEnumerable`1[[Foo, test, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null]].GetEnumerator CSC: System.Collections.Generic.IEnumerator<Foo>.Current As you can see, generic parameter handling is quite different -- <Foo> vs. `1[[Foo, test, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null]]. The same generic parameter handling difference exists for properties as well as methods. This difference is somewhat important because it's user-visible: you can use System.Type.GetMember(string, BindingFlags) to load explicitly-implemented interface members on a given type, but to do so you need to use the *same* name as is present within the assemblies metadata. Consequently, this means that different strings must be used to obtain the same member depending on whether the assembly was compiled by CSC or gmcs (the Mono/.NET runtime is irrelevant). Again, the question: Should these differences be considered bugs within Mono? Thanks, - Jon
// reflection on explicitly-implemented members? using System; using System.Collections; using System.Collections.Generic; using System.Reflection; class Foo : IEnumerable, IEnumerable<Foo>, IEnumerator, IEnumerator<Foo> { IEnumerator IEnumerable.GetEnumerator () { return null; } IEnumerator<Foo> IEnumerable<Foo>.GetEnumerator () { return null; } bool IEnumerator.MoveNext () { return false; } object IEnumerator.Current { get { return null; } } Foo IEnumerator<Foo>.Current { get { return null; } } void IEnumerator.Reset () { } void IDisposable.Dispose () { } void PrivateMethod () { } } class Test { public static void Main () { Type t = typeof(Foo); BindingFlags f = BindingFlags.Instance | BindingFlags.Static | BindingFlags.Public | BindingFlags.NonPublic | BindingFlags.DeclaredOnly; foreach (MethodInfo m in t.GetMethods(f)) { PrintMethod (m); } foreach (PropertyInfo p in t.GetProperties (f)) { PrintProperty (p); PrintMethod (p.GetGetMethod(true) ?? p.GetSetMethod(true)); } #if false MethodInfo mi = t.GetMethod ("System.Collections.IEnumerable.GetEnumerator", f); PrintMethod (mi); mi = t.GetMethod ("System.Collections.Generic.IEnumerable<Foo>.GetEnumerator", f); PrintMethod (mi); #endif } private static void PrintMethod (MethodInfo m) { Console.WriteLine ("Method: {0}", m.Name); foreach (PropertyInfo pi in m.GetType().GetProperties()) { Console.WriteLine ("\t{0}: {1}", pi.Name, pi.GetValue (m, null)); } } private static void PrintProperty (PropertyInfo m) { Console.WriteLine ("Property: {0}", m.Name); foreach (PropertyInfo pi in m.GetType().GetProperties()) { Console.WriteLine ("\t{0}: {1}", pi.Name, pi.GetValue (m, null)); } } }
// Microsoft (R) .NET Framework IL Disassembler. Version 2.0.50727.42 // Copyright (c) Microsoft Corporation. All rights reserved. // Classes defined in this module: //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ // Class Foo (auto) (ansi) // Class Test (auto) (ansi) //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ // Metadata version: v2.0.50727 .assembly extern mscorlib { .publickeytoken = (B7 7A 5C 56 19 34 E0 89 ) // .z\V.4.. .ver 2:0:0:0 } .assembly test { .custom instance void [mscorlib]System.Runtime.CompilerServices.RuntimeCompatibilityAttribute::.ctor() = ( 01 00 01 00 54 02 16 57 72 61 70 4E 6F 6E 45 78 // ....T..WrapNonEx 63 65 70 74 69 6F 6E 54 68 72 6F 77 73 01 ) // ceptionThrows. .hash algorithm 0x00008004 .ver 0:0:0:0 } .module test.exe // MVID: {A120F212-50BE-4EC6-8A5C-525380F53462} .imagebase 0x00400000 .file alignment 0x00000200 .stackreserve 0x00100000 .subsystem 0x0003 // WINDOWS_CUI .corflags 0x00000001 // ILONLY // Image base: 0x035B0000 // =============== CLASS MEMBERS DECLARATION =================== .class private auto ansi beforefieldinit Foo extends [mscorlib]System.Object implements [mscorlib]System.Collections.IEnumerable, class [mscorlib]System.Collections.Generic.IEnumerable`1<class Foo>, [mscorlib]System.Collections.IEnumerator, class [mscorlib]System.Collections.Generic.IEnumerator`1<class Foo>, [mscorlib]System.IDisposable { .method public hidebysig specialname rtspecialname instance void .ctor() cil managed { // Code size 7 (0x7) .maxstack 8 IL_0000: ldarg.0 IL_0001: call instance void [mscorlib]System.Object::.ctor() IL_0006: ret } // end of method Foo::.ctor .method private hidebysig newslot virtual final instance class [mscorlib]System.Collections.IEnumerator System.Collections.IEnumerable.GetEnumerator() cil managed { .override [mscorlib]System.Collections.IEnumerable::GetEnumerator // Code size 2 (0x2) .maxstack 8 IL_0000: ldnull IL_0001: ret } // end of method Foo::System.Collections.IEnumerable.GetEnumerator .method private hidebysig newslot virtual final instance class [mscorlib]System.Collections.Generic.IEnumerator`1<class Foo> 'System.Collections.Generic.IEnumerable`1[[Foo, test, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null]].GetEnumerator'() cil managed { .override method instance class [mscorlib]System.Collections.Generic.IEnumerator`1<!0> class [mscorlib]System.Collections.Generic.IEnumerable`1<class Foo>::GetEnumerator() // Code size 2 (0x2) .maxstack 8 IL_0000: ldnull IL_0001: ret } // end of method Foo::'System.Collections.Generic.IEnumerable`1[[Foo, test, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null]].GetEnumerator' .method private hidebysig newslot virtual final instance bool System.Collections.IEnumerator.MoveNext() cil managed { .override [mscorlib]System.Collections.IEnumerator::MoveNext // Code size 2 (0x2) .maxstack 8 IL_0000: ldc.i4.0 IL_0001: ret } // end of method Foo::System.Collections.IEnumerator.MoveNext .method private hidebysig newslot specialname virtual final instance object System.Collections.IEnumerator.get_Current() cil managed { .override [mscorlib]System.Collections.IEnumerator::get_Current // Code size 2 (0x2) .maxstack 8 IL_0000: ldnull IL_0001: ret } // end of method Foo::System.Collections.IEnumerator.get_Current .method private hidebysig newslot specialname virtual final instance class Foo 'System.Collections.Generic.IEnumerator`1[[Foo, test, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null]].get_Current'() cil managed { .override method instance !0 class [mscorlib]System.Collections.Generic.IEnumerator`1<class Foo>::get_Current() // Code size 2 (0x2) .maxstack 8 IL_0000: ldnull IL_0001: ret } // end of method Foo::'System.Collections.Generic.IEnumerator`1[[Foo, test, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null]].get_Current' .method private hidebysig newslot virtual final instance void System.Collections.IEnumerator.Reset() cil managed { .override [mscorlib]System.Collections.IEnumerator::Reset // Code size 1 (0x1) .maxstack 8 IL_0000: ret } // end of method Foo::System.Collections.IEnumerator.Reset .method private hidebysig newslot virtual final instance void System.IDisposable.Dispose() cil managed { .override [mscorlib]System.IDisposable::Dispose // Code size 1 (0x1) .maxstack 8 IL_0000: ret } // end of method Foo::System.IDisposable.Dispose .method private hidebysig instance void PrivateMethod() cil managed { // Code size 1 (0x1) .maxstack 8 IL_0000: ret } // end of method Foo::PrivateMethod .property object IEnumerator.Current() { .get instance object Foo::System.Collections.IEnumerator.get_Current() } // end of property Foo::IEnumerator.Current .property class Foo 'IEnumerator<Foo>.Current'() { .get instance class Foo Foo::'System.Collections.Generic.IEnumerator`1[[Foo, test, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null]].get_Current'() } // end of property Foo::'IEnumerator<Foo>.Current' } // end of class Foo .class private auto ansi beforefieldinit Test extends [mscorlib]System.Object { .method public hidebysig specialname rtspecialname instance void .ctor() cil managed { // Code size 7 (0x7) .maxstack 8 IL_0000: ldarg.0 IL_0001: call instance void [mscorlib]System.Object::.ctor() IL_0006: ret } // end of method Test::.ctor .method public hidebysig static void Main() cil managed { .entrypoint // Code size 142 (0x8e) .maxstack 15 .locals init (class [mscorlib]System.Type V_0, valuetype [mscorlib]System.Reflection.BindingFlags V_1, class [mscorlib]System.Reflection.MethodInfo V_2, class [mscorlib]System.Reflection.MethodInfo[] V_3, int32 V_4, int32 V_5, class [mscorlib]System.Reflection.PropertyInfo V_6, class [mscorlib]System.Reflection.PropertyInfo[] V_7, int32 V_8, int32 V_9) IL_0000: ldtoken Foo IL_0005: call class [mscorlib]System.Type [mscorlib]System.Type::GetTypeFromHandle(valuetype [mscorlib]System.RuntimeTypeHandle) IL_000a: stloc.0 IL_000b: ldc.i4.s 62 IL_000d: stloc.1 IL_000e: ldloc.0 IL_000f: ldloc.1 IL_0010: callvirt instance class [mscorlib]System.Reflection.MethodInfo[] [mscorlib]System.Type::GetMethods(valuetype [mscorlib]System.Reflection.BindingFlags) IL_0015: stloc.3 IL_0016: ldloc.3 IL_0017: ldlen IL_0018: conv.i4 IL_0019: stloc.s V_5 IL_001b: ldc.i4.0 IL_001c: stloc.s V_4 IL_001e: br IL_0034 IL_0023: ldloc.3 IL_0024: ldloc.s V_4 IL_0026: ldelem.ref IL_0027: stloc.2 IL_0028: ldloc.2 IL_0029: call void Test::PrintMethod(class [mscorlib]System.Reflection.MethodInfo) IL_002e: ldloc.s V_4 IL_0030: ldc.i4.1 IL_0031: add IL_0032: stloc.s V_4 IL_0034: ldloc.s V_4 IL_0036: ldloc.s V_5 IL_0038: blt IL_0023 IL_003d: ldloc.0 IL_003e: ldloc.1 IL_003f: callvirt instance class [mscorlib]System.Reflection.PropertyInfo[] [mscorlib]System.Type::GetProperties(valuetype [mscorlib]System.Reflection.BindingFlags) IL_0044: stloc.s V_7 IL_0046: ldloc.s V_7 IL_0048: ldlen IL_0049: conv.i4 IL_004a: stloc.s V_9 IL_004c: ldc.i4.0 IL_004d: stloc.s V_8 IL_004f: br IL_0084 IL_0054: ldloc.s V_7 IL_0056: ldloc.s V_8 IL_0058: ldelem.ref IL_0059: stloc.s V_6 IL_005b: ldloc.s V_6 IL_005d: call void Test::PrintProperty(class [mscorlib]System.Reflection.PropertyInfo) IL_0062: ldloc.s V_6 IL_0064: ldc.i4.1 IL_0065: callvirt instance class [mscorlib]System.Reflection.MethodInfo [mscorlib]System.Reflection.PropertyInfo::GetGetMethod(bool) IL_006a: dup IL_006b: brtrue IL_0079 IL_0070: pop IL_0071: ldloc.s V_6 IL_0073: ldc.i4.1 IL_0074: callvirt instance class [mscorlib]System.Reflection.MethodInfo [mscorlib]System.Reflection.PropertyInfo::GetSetMethod(bool) IL_0079: call void Test::PrintMethod(class [mscorlib]System.Reflection.MethodInfo) IL_007e: ldloc.s V_8 IL_0080: ldc.i4.1 IL_0081: add IL_0082: stloc.s V_8 IL_0084: ldloc.s V_8 IL_0086: ldloc.s V_9 IL_0088: blt IL_0054 IL_008d: ret } // end of method Test::Main .method private hidebysig static void PrintMethod(class [mscorlib]System.Reflection.MethodInfo m) cil managed { // Code size 79 (0x4f) .maxstack 15 .locals init (class [mscorlib]System.Reflection.PropertyInfo V_0, class [mscorlib]System.Reflection.PropertyInfo[] V_1, int32 V_2, int32 V_3) IL_0000: ldstr "Method: {0}" IL_0005: ldarg.0 IL_0006: callvirt instance string [mscorlib]System.Reflection.MemberInfo::get_Name() IL_000b: call void [mscorlib]System.Console::WriteLine(string, object) IL_0010: ldarg.0 IL_0011: callvirt instance class [mscorlib]System.Type [mscorlib]System.Object::GetType() IL_0016: callvirt instance class [mscorlib]System.Reflection.PropertyInfo[] [mscorlib]System.Type::GetProperties() IL_001b: stloc.1 IL_001c: ldloc.1 IL_001d: ldlen IL_001e: conv.i4 IL_001f: stloc.3 IL_0020: ldc.i4.0 IL_0021: stloc.2 IL_0022: br IL_0047 IL_0027: ldloc.1 IL_0028: ldloc.2 IL_0029: ldelem.ref IL_002a: stloc.0 IL_002b: ldstr "\t{0}: {1}" IL_0030: ldloc.0 IL_0031: callvirt instance string [mscorlib]System.Reflection.MemberInfo::get_Name() IL_0036: ldloc.0 IL_0037: ldarg.0 IL_0038: ldnull IL_0039: callvirt instance object [mscorlib]System.Reflection.PropertyInfo::GetValue(object, object[]) IL_003e: call void [mscorlib]System.Console::WriteLine(string, object, object) IL_0043: ldloc.2 IL_0044: ldc.i4.1 IL_0045: add IL_0046: stloc.2 IL_0047: ldloc.2 IL_0048: ldloc.3 IL_0049: blt IL_0027 IL_004e: ret } // end of method Test::PrintMethod .method private hidebysig static void PrintProperty(class [mscorlib]System.Reflection.PropertyInfo m) cil managed { // Code size 79 (0x4f) .maxstack 15 .locals init (class [mscorlib]System.Reflection.PropertyInfo V_0, class [mscorlib]System.Reflection.PropertyInfo[] V_1, int32 V_2, int32 V_3) IL_0000: ldstr "Property: {0}" IL_0005: ldarg.0 IL_0006: callvirt instance string [mscorlib]System.Reflection.MemberInfo::get_Name() IL_000b: call void [mscorlib]System.Console::WriteLine(string, object) IL_0010: ldarg.0 IL_0011: callvirt instance class [mscorlib]System.Type [mscorlib]System.Object::GetType() IL_0016: callvirt instance class [mscorlib]System.Reflection.PropertyInfo[] [mscorlib]System.Type::GetProperties() IL_001b: stloc.1 IL_001c: ldloc.1 IL_001d: ldlen IL_001e: conv.i4 IL_001f: stloc.3 IL_0020: ldc.i4.0 IL_0021: stloc.2 IL_0022: br IL_0047 IL_0027: ldloc.1 IL_0028: ldloc.2 IL_0029: ldelem.ref IL_002a: stloc.0 IL_002b: ldstr "\t{0}: {1}" IL_0030: ldloc.0 IL_0031: callvirt instance string [mscorlib]System.Reflection.MemberInfo::get_Name() IL_0036: ldloc.0 IL_0037: ldarg.0 IL_0038: ldnull IL_0039: callvirt instance object [mscorlib]System.Reflection.PropertyInfo::GetValue(object, object[]) IL_003e: call void [mscorlib]System.Console::WriteLine(string, object, object) IL_0043: ldloc.2 IL_0044: ldc.i4.1 IL_0045: add IL_0046: stloc.2 IL_0047: ldloc.2 IL_0048: ldloc.3 IL_0049: blt IL_0027 IL_004e: ret } // end of method Test::PrintProperty } // end of class Test // ============================================================= // *********** DISASSEMBLY COMPLETE *********************** // WARNING: Created Win32 resource file C:\gmcsCompiled.res
// Microsoft (R) .NET Framework IL Disassembler. Version 2.0.50727.42 // Copyright (c) Microsoft Corporation. All rights reserved. // Classes defined in this module: //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ // Class Foo (auto) (ansi) // Class Test (auto) (ansi) //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ // Metadata version: v2.0.50727 .assembly extern mscorlib { .publickeytoken = (B7 7A 5C 56 19 34 E0 89 ) // .z\V.4.. .ver 2:0:0:0 } .assembly test { .custom instance void [mscorlib]System.Runtime.CompilerServices.CompilationRelaxationsAttribute::.ctor(int32) = ( 01 00 08 00 00 00 00 00 ) .custom instance void [mscorlib]System.Runtime.CompilerServices.RuntimeCompatibilityAttribute::.ctor() = ( 01 00 01 00 54 02 16 57 72 61 70 4E 6F 6E 45 78 // ....T..WrapNonEx 63 65 70 74 69 6F 6E 54 68 72 6F 77 73 01 ) // ceptionThrows. .hash algorithm 0x00008004 .ver 0:0:0:0 } .module test.exe // MVID: {6D4BF394-BE5C-42C5-8A86-7504EBBD3AE3} .imagebase 0x00400000 .file alignment 0x00000200 .stackreserve 0x00100000 .subsystem 0x0003 // WINDOWS_CUI .corflags 0x00000001 // ILONLY // Image base: 0x01030000 // =============== CLASS MEMBERS DECLARATION =================== .class private auto ansi beforefieldinit Foo extends [mscorlib]System.Object implements class [mscorlib]System.Collections.Generic.IEnumerable`1<class Foo>, [mscorlib]System.Collections.IEnumerable, class [mscorlib]System.Collections.Generic.IEnumerator`1<class Foo>, [mscorlib]System.IDisposable, [mscorlib]System.Collections.IEnumerator { .method private hidebysig newslot virtual final instance class [mscorlib]System.Collections.IEnumerator System.Collections.IEnumerable.GetEnumerator() cil managed { .override [mscorlib]System.Collections.IEnumerable::GetEnumerator // Code size 7 (0x7) .maxstack 1 .locals init (class [mscorlib]System.Collections.IEnumerator V_0) IL_0000: nop IL_0001: ldnull IL_0002: stloc.0 IL_0003: br.s IL_0005 IL_0005: ldloc.0 IL_0006: ret } // end of method Foo::System.Collections.IEnumerable.GetEnumerator .method private hidebysig newslot virtual final instance class [mscorlib]System.Collections.Generic.IEnumerator`1<class Foo> 'System.Collections.Generic.IEnumerable<Foo>.GetEnumerator'() cil managed { .override method instance class [mscorlib]System.Collections.Generic.IEnumerator`1<!0> class [mscorlib]System.Collections.Generic.IEnumerable`1<class Foo>::GetEnumerator() // Code size 7 (0x7) .maxstack 1 .locals init (class [mscorlib]System.Collections.Generic.IEnumerator`1<class Foo> V_0) IL_0000: nop IL_0001: ldnull IL_0002: stloc.0 IL_0003: br.s IL_0005 IL_0005: ldloc.0 IL_0006: ret } // end of method Foo::'System.Collections.Generic.IEnumerable<Foo>.GetEnumerator' .method private hidebysig newslot virtual final instance bool System.Collections.IEnumerator.MoveNext() cil managed { .override [mscorlib]System.Collections.IEnumerator::MoveNext // Code size 7 (0x7) .maxstack 1 .locals init (bool V_0) IL_0000: nop IL_0001: ldc.i4.0 IL_0002: stloc.0 IL_0003: br.s IL_0005 IL_0005: ldloc.0 IL_0006: ret } // end of method Foo::System.Collections.IEnumerator.MoveNext .method private hidebysig newslot specialname virtual final instance object System.Collections.IEnumerator.get_Current() cil managed { .override [mscorlib]System.Collections.IEnumerator::get_Current // Code size 7 (0x7) .maxstack 1 .locals init (object V_0) IL_0000: nop IL_0001: ldnull IL_0002: stloc.0 IL_0003: br.s IL_0005 IL_0005: ldloc.0 IL_0006: ret } // end of method Foo::System.Collections.IEnumerator.get_Current .method private hidebysig newslot specialname virtual final instance class Foo 'System.Collections.Generic.IEnumerator<Foo>.get_Current'() cil managed { .override method instance !0 class [mscorlib]System.Collections.Generic.IEnumerator`1<class Foo>::get_Current() // Code size 7 (0x7) .maxstack 1 .locals init (class Foo V_0) IL_0000: nop IL_0001: ldnull IL_0002: stloc.0 IL_0003: br.s IL_0005 IL_0005: ldloc.0 IL_0006: ret } // end of method Foo::'System.Collections.Generic.IEnumerator<Foo>.get_Current' .method private hidebysig newslot virtual final instance void System.Collections.IEnumerator.Reset() cil managed { .override [mscorlib]System.Collections.IEnumerator::Reset // Code size 2 (0x2) .maxstack 8 IL_0000: nop IL_0001: ret } // end of method Foo::System.Collections.IEnumerator.Reset .method private hidebysig newslot virtual final instance void System.IDisposable.Dispose() cil managed { .override [mscorlib]System.IDisposable::Dispose // Code size 2 (0x2) .maxstack 8 IL_0000: nop IL_0001: ret } // end of method Foo::System.IDisposable.Dispose .method private hidebysig instance void PrivateMethod() cil managed { // Code size 2 (0x2) .maxstack 8 IL_0000: nop IL_0001: ret } // end of method Foo::PrivateMethod .method public hidebysig specialname rtspecialname instance void .ctor() cil managed { // Code size 7 (0x7) .maxstack 8 IL_0000: ldarg.0 IL_0001: call instance void [mscorlib]System.Object::.ctor() IL_0006: ret } // end of method Foo::.ctor .property instance object System.Collections.IEnumerator.Current() { .get instance object Foo::System.Collections.IEnumerator.get_Current() } // end of property Foo::System.Collections.IEnumerator.Current .property instance class Foo 'System.Collections.Generic.IEnumerator<Foo>.Current'() { .get instance class Foo Foo::'System.Collections.Generic.IEnumerator<Foo>.get_Current'() } // end of property Foo::'System.Collections.Generic.IEnumerator<Foo>.Current' } // end of class Foo .class private auto ansi beforefieldinit Test extends [mscorlib]System.Object { .method public hidebysig static void Main() cil managed { .entrypoint // Code size 140 (0x8c) .maxstack 2 .locals init (class [mscorlib]System.Type V_0, valuetype [mscorlib]System.Reflection.BindingFlags V_1, class [mscorlib]System.Reflection.MethodInfo V_2, class [mscorlib]System.Reflection.PropertyInfo V_3, class [mscorlib]System.Reflection.MethodInfo[] V_4, int32 V_5, bool V_6, class [mscorlib]System.Reflection.PropertyInfo[] V_7) IL_0000: nop IL_0001: ldtoken Foo IL_0006: call class [mscorlib]System.Type [mscorlib]System.Type::GetTypeFromHandle(valuetype [mscorlib]System.RuntimeTypeHandle) IL_000b: stloc.0 IL_000c: ldc.i4.s 62 IL_000e: stloc.1 IL_000f: nop IL_0010: ldloc.0 IL_0011: ldloc.1 IL_0012: callvirt instance class [mscorlib]System.Reflection.MethodInfo[] [mscorlib]System.Type::GetMethods(valuetype [mscorlib]System.Reflection.BindingFlags) IL_0017: stloc.s V_4 IL_0019: ldc.i4.0 IL_001a: stloc.s V_5 IL_001c: br.s IL_0033 IL_001e: ldloc.s V_4 IL_0020: ldloc.s V_5 IL_0022: ldelem.ref IL_0023: stloc.2 IL_0024: nop IL_0025: ldloc.2 IL_0026: call void Test::PrintMethod(class [mscorlib]System.Reflection.MethodInfo) IL_002b: nop IL_002c: nop IL_002d: ldloc.s V_5 IL_002f: ldc.i4.1 IL_0030: add IL_0031: stloc.s V_5 IL_0033: ldloc.s V_5 IL_0035: ldloc.s V_4 IL_0037: ldlen IL_0038: conv.i4 IL_0039: clt IL_003b: stloc.s V_6 IL_003d: ldloc.s V_6 IL_003f: brtrue.s IL_001e IL_0041: nop IL_0042: ldloc.0 IL_0043: ldloc.1 IL_0044: callvirt instance class [mscorlib]System.Reflection.PropertyInfo[] [mscorlib]System.Type::GetProperties(valuetype [mscorlib]System.Reflection.BindingFlags) IL_0049: stloc.s V_7 IL_004b: ldc.i4.0 IL_004c: stloc.s V_5 IL_004e: br.s IL_007d IL_0050: ldloc.s V_7 IL_0052: ldloc.s V_5 IL_0054: ldelem.ref IL_0055: stloc.3 IL_0056: nop IL_0057: ldloc.3 IL_0058: call void Test::PrintProperty(class [mscorlib]System.Reflection.PropertyInfo) IL_005d: nop IL_005e: ldloc.3 IL_005f: ldc.i4.1 IL_0060: callvirt instance class [mscorlib]System.Reflection.MethodInfo [mscorlib]System.Reflection.PropertyInfo::GetGetMethod(bool) IL_0065: dup IL_0066: brtrue.s IL_0070 IL_0068: pop IL_0069: ldloc.3 IL_006a: ldc.i4.1 IL_006b: callvirt instance class [mscorlib]System.Reflection.MethodInfo [mscorlib]System.Reflection.PropertyInfo::GetSetMethod(bool) IL_0070: call void Test::PrintMethod(class [mscorlib]System.Reflection.MethodInfo) IL_0075: nop IL_0076: nop IL_0077: ldloc.s V_5 IL_0079: ldc.i4.1 IL_007a: add IL_007b: stloc.s V_5 IL_007d: ldloc.s V_5 IL_007f: ldloc.s V_7 IL_0081: ldlen IL_0082: conv.i4 IL_0083: clt IL_0085: stloc.s V_6 IL_0087: ldloc.s V_6 IL_0089: brtrue.s IL_0050 IL_008b: ret } // end of method Test::Main .method private hidebysig static void PrintMethod(class [mscorlib]System.Reflection.MethodInfo m) cil managed { // Code size 81 (0x51) .maxstack 5 .locals init (class [mscorlib]System.Reflection.PropertyInfo V_0, class [mscorlib]System.Reflection.PropertyInfo[] V_1, int32 V_2, bool V_3) IL_0000: nop IL_0001: ldstr "Method: {0}" IL_0006: ldarg.0 IL_0007: callvirt instance string [mscorlib]System.Reflection.MemberInfo::get_Name() IL_000c: call void [mscorlib]System.Console::WriteLine(string, object) IL_0011: nop IL_0012: nop IL_0013: ldarg.0 IL_0014: callvirt instance class [mscorlib]System.Type [mscorlib]System.Object::GetType() IL_0019: callvirt instance class [mscorlib]System.Reflection.PropertyInfo[] [mscorlib]System.Type::GetProperties() IL_001e: stloc.1 IL_001f: ldc.i4.0 IL_0020: stloc.2 IL_0021: br.s IL_0046 IL_0023: ldloc.1 IL_0024: ldloc.2 IL_0025: ldelem.ref IL_0026: stloc.0 IL_0027: nop IL_0028: ldstr "\t{0}: {1}" IL_002d: ldloc.0 IL_002e: callvirt instance string [mscorlib]System.Reflection.MemberInfo::get_Name() IL_0033: ldloc.0 IL_0034: ldarg.0 IL_0035: ldnull IL_0036: callvirt instance object [mscorlib]System.Reflection.PropertyInfo::GetValue(object, object[]) IL_003b: call void [mscorlib]System.Console::WriteLine(string, object, object) IL_0040: nop IL_0041: nop IL_0042: ldloc.2 IL_0043: ldc.i4.1 IL_0044: add IL_0045: stloc.2 IL_0046: ldloc.2 IL_0047: ldloc.1 IL_0048: ldlen IL_0049: conv.i4 IL_004a: clt IL_004c: stloc.3 IL_004d: ldloc.3 IL_004e: brtrue.s IL_0023 IL_0050: ret } // end of method Test::PrintMethod .method private hidebysig static void PrintProperty(class [mscorlib]System.Reflection.PropertyInfo m) cil managed { // Code size 81 (0x51) .maxstack 5 .locals init (class [mscorlib]System.Reflection.PropertyInfo V_0, class [mscorlib]System.Reflection.PropertyInfo[] V_1, int32 V_2, bool V_3) IL_0000: nop IL_0001: ldstr "Property: {0}" IL_0006: ldarg.0 IL_0007: callvirt instance string [mscorlib]System.Reflection.MemberInfo::get_Name() IL_000c: call void [mscorlib]System.Console::WriteLine(string, object) IL_0011: nop IL_0012: nop IL_0013: ldarg.0 IL_0014: callvirt instance class [mscorlib]System.Type [mscorlib]System.Object::GetType() IL_0019: callvirt instance class [mscorlib]System.Reflection.PropertyInfo[] [mscorlib]System.Type::GetProperties() IL_001e: stloc.1 IL_001f: ldc.i4.0 IL_0020: stloc.2 IL_0021: br.s IL_0046 IL_0023: ldloc.1 IL_0024: ldloc.2 IL_0025: ldelem.ref IL_0026: stloc.0 IL_0027: nop IL_0028: ldstr "\t{0}: {1}" IL_002d: ldloc.0 IL_002e: callvirt instance string [mscorlib]System.Reflection.MemberInfo::get_Name() IL_0033: ldloc.0 IL_0034: ldarg.0 IL_0035: ldnull IL_0036: callvirt instance object [mscorlib]System.Reflection.PropertyInfo::GetValue(object, object[]) IL_003b: call void [mscorlib]System.Console::WriteLine(string, object, object) IL_0040: nop IL_0041: nop IL_0042: ldloc.2 IL_0043: ldc.i4.1 IL_0044: add IL_0045: stloc.2 IL_0046: ldloc.2 IL_0047: ldloc.1 IL_0048: ldlen IL_0049: conv.i4 IL_004a: clt IL_004c: stloc.3 IL_004d: ldloc.3 IL_004e: brtrue.s IL_0023 IL_0050: ret } // end of method Test::PrintProperty .method public hidebysig specialname rtspecialname instance void .ctor() cil managed { // Code size 7 (0x7) .maxstack 8 IL_0000: ldarg.0 IL_0001: call instance void [mscorlib]System.Object::.ctor() IL_0006: ret } // end of method Test::.ctor } // end of class Test // ============================================================= // *********** DISASSEMBLY COMPLETE *********************** // WARNING: Created Win32 resource file C:\cscVersion.res
_______________________________________________ Mono-devel-list mailing list Mono-devel-list@lists.ximian.com http://lists.ximian.com/mailman/listinfo/mono-devel-list