Click here to Skip to main content
12,406,986 members (60,340 online)
Click here to Skip to main content
Articles » Languages » C# » Reflection » Downloads

Stats

66.8K views
338 downloads
71 bookmarked
Posted

Introduction to Creating Dynamic Types with Reflection.Emit: Part 2

, 1 May 2006 CPOL
Part 2 of an introduction to creating dynamic types. This article shows how to actually generate the methods in a dynamic type and how to call them.
//IL for using switch statement
.method public hidebysig newslot virtual final 
        instance int32  GetOrdinal(string colName) cil managed
{
  // Code size       191 (0xbf)
  .maxstack  2
  //Get locals defined
  .locals init ([0] int32 hash,
           [1] int32 CS$00000003$00000000,
           [2] int32 CS$00000002$00000001)
           
  //Store off hash code for string input parm
  IL_0000:  ldarg.1
  IL_0001:  callvirt   instance int32 [mscorlib]System.String::GetHashCode()
  IL_0006:  stloc.0
  
  
  IL_0007:  ldloc.0
  IL_0008:  stloc.2
  IL_0009:  ldloc.2
  IL_000a:  ldc.i4     0xdbabc50d	//3,685,467,405
  IL_000f:  bgt.s      IL_0048
  IL_0011:  ldloc.2
  IL_0012:  ldc.i4     0xb0fd533d	//2,969,391,933
  IL_0017:  bgt.s      IL_002e
  IL_0019:  ldloc.2
  IL_001a:  ldc.i4     0x85886445	//2,240,308,293
  IL_001f:  beq.s      IL_0088
  IL_0021:  ldloc.2
  IL_0022:  ldc.i4     0xb0fd533d	//2,969,391,933
  IL_0027:  beq.s      IL_00a0
  IL_0029:  br         IL_00b2
  IL_002e:  ldloc.2
  IL_002f:  ldc.i4     0xbd1fa1e2	//3,172,966,882
  IL_0034:  beq.s      IL_008c
  IL_0036:  ldloc.2
  IL_0037:  ldc.i4     0xc4561f7d	//3,293,978,493
  IL_003c:  beq.s      IL_009c
  IL_003e:  ldloc.2
  IL_003f:  ldc.i4     0xdbabc50d	//3,685,467,405
  IL_0044:  beq.s      IL_00a4
  IL_0046:  br.s       IL_00b2
  IL_0048:  ldloc.2
  IL_0049:  ldc.i4     0x12f6f393	//318,174,099 5
  IL_004e:  bgt.s      IL_006a
  IL_0050:  ldloc.2
  IL_0051:  ldc.i4     0xb87b61a	//193,443,354 11
  IL_0056:  beq.s      IL_00ad
  IL_0058:  ldloc.2
  IL_0059:  ldc.i4     0xde11eb9	//232,857,273 10
  IL_005e:  beq.s      IL_00a8
  IL_0060:  ldloc.2
  IL_0061:  ldc.i4     0x12f6f393	//31,817,099
  IL_0066:  beq.s      IL_0094
  IL_0068:  br.s       IL_00b2
  IL_006a:  ldloc.2
  IL_006b:  ldc.i4     0x61cad525	//1,640,682,789 4
  IL_0070:  beq.s      IL_0090
  IL_0072:  ldloc.2
  IL_0073:  ldc.i4     0x76ed75cc	//1,995,273,676 1
  IL_0078:  beq.s      IL_0084
  IL_007a:  ldloc.2
  IL_007b:  ldc.i4     0x7c816842	//2,088,855,618 6
  IL_0080:  beq.s      IL_0098
  IL_0082:  br.s       IL_00b2
  IL_0084:  ldc.i4.0
  IL_0085:  stloc.1
  IL_0086:  br.s       IL_00bd
  IL_0088:  ldc.i4.1
  IL_0089:  stloc.1
  IL_008a:  br.s       IL_00bd
  IL_008c:  ldc.i4.2
  IL_008d:  stloc.1
  IL_008e:  br.s       IL_00bd
  IL_0090:  ldc.i4.3
  IL_0091:  stloc.1
  IL_0092:  br.s       IL_00bd
  IL_0094:  ldc.i4.4
  IL_0095:  stloc.1
  IL_0096:  br.s       IL_00bd
  IL_0098:  ldc.i4.5
  IL_0099:  stloc.1
  IL_009a:  br.s       IL_00bd
  IL_009c:  ldc.i4.6
  IL_009d:  stloc.1
  IL_009e:  br.s       IL_00bd
  IL_00a0:  ldc.i4.7
  IL_00a1:  stloc.1
  IL_00a2:  br.s       IL_00bd
  IL_00a4:  ldc.i4.8
  IL_00a5:  stloc.1
  IL_00a6:  br.s       IL_00bd
  IL_00a8:  ldc.i4.s   9
  IL_00aa:  stloc.1
  IL_00ab:  br.s       IL_00bd
  IL_00ad:  ldc.i4.s   10
  IL_00af:  stloc.1
  IL_00b0:  br.s       IL_00bd
  IL_00b2:  ldstr      "Column not found"
  IL_00b7:  newobj     instance void [mscorlib]System.ApplicationException::.ctor(string)
  IL_00bc:  throw
  IL_00bd:  ldloc.1
  IL_00be:  ret
} // end of method DataSetAdapterWithHashCodeSwitch::GetOrdinal
















  
  
  
  .method public hidebysig newslot virtual final 
        instance int32  GetOrdinal(string colName) cil managed
{
  // Code size       93 (0x5d)
  .maxstack  3
  .locals init ([0] int32 CS$00000003$00000000)
  IL_0000:  ldarg.1
  IL_0001:  ldstr      "Address"
  IL_0006:  call       bool [mscorlib]System.String::op_Equality(string,
                                                                 string)
  IL_000b:  brfalse.s  IL_0017
  IL_000d:  ldsfld     int32[] DataRowAdapter.DataRowAdapter::rows
  IL_0012:  ldc.i4.0
  IL_0013:  ldelem.i4
  IL_0014:  stloc.0
  IL_0015:  br.s       IL_005b
  IL_0017:  ldarg.1
  IL_0018:  ldstr      "City"
  IL_001d:  call       bool [mscorlib]System.String::op_Equality(string,
                                                                 string)
  IL_0022:  brfalse.s  IL_002e
  IL_0024:  ldsfld     int32[] DataRowAdapter.DataRowAdapter::rows
  IL_0029:  ldc.i4.1
  IL_002a:  ldelem.i4
  IL_002b:  stloc.0
  IL_002c:  br.s       IL_005b
  IL_002e:  ldarg.1
  IL_002f:  ldstr      "CompanyName"
  IL_0034:  call       bool [mscorlib]System.String::op_Equality(string,
                                                                 string)
  IL_0039:  brfalse.s  IL_0045
  IL_003b:  ldsfld     int32[] DataRowAdapter.DataRowAdapter::rows
  IL_0040:  ldc.i4.2
  IL_0041:  ldelem.i4
  IL_0042:  stloc.0
  IL_0043:  br.s       IL_005b
  IL_0045:  ldstr      "Column '"
  IL_004a:  ldarg.1
  IL_004b:  ldstr      "' not found"
  IL_0050:  call       string [mscorlib]System.String::Concat(string,
                                                              string,
                                                              string)
  IL_0055:  newobj     instance void [mscorlib]System.ApplicationException::.ctor(string)
  IL_005a:  throw
  IL_005b:  ldloc.0
  IL_005c:  ret
} // end of method DataRowAdapter::GetOrdinal


  
  
  
  
  
  
  
  
  
  
  
  
  
  
  
  
  
  
  
  
  
  
  
  
  
  
  
  
  
  
  
  
  .class /*02000008*/ public auto ansi beforefieldinit DataSetAdapter15WithInterface
         extends [mscorlib/* 23000001 */]System.Object/* 01000001 */
         implements EmitPerfTesting.IDataRowAdapter/* 02000004 */
  {
    .field /*04000014*/ private static bool isInitialized
    .field /*04000015*/ private static int32[] rows
    .method /*0600003D*/ public hidebysig specialname rtspecialname 
            instance void  .ctor() cil managed
    // SIG: 20 00 01
    {
      // Method begins at RVA 0x3c30
      // Code size       7 (0x7)
      .maxstack  1
      IL_0000:  /* 02   |                  */ ldarg.0
      IL_0001:  /* 28   | (0A)00000D       */ call       instance void [mscorlib/* 23000001 */]System.Object/* 01000001 */::.ctor() /* 0A00000D */
      IL_0006:  /* 2A   |                  */ ret
    } // end of method DataSetAdapter15WithInterface::.ctor

    .method /*0600003E*/ public hidebysig newslot virtual final 
            instance void  Initialize(class [System.Data/* 23000004 */]System.Data.DataSet/* 01000006 */ ds) cil managed
    // SIG: 20 01 01 12 19
    {
      // Method begins at RVA 0x3c44
      // Code size       19 (0x13)
      .maxstack  4
      IL_0000:  /* 02   |                  */ ldarg.0
      IL_0001:  /* 03   |                  */ ldarg.1
      IL_0002:  /* 6F   | (0A)000019       */ callvirt   instance class [System.Data/* 23000004 */]System.Data.DataTableCollection/* 01000026 */ [System.Data/* 23000004 */]System.Data.DataSet/* 01000006 */::get_Tables() /* 0A000019 */
      IL_0007:  /* 16   |                  */ ldc.i4.0
      IL_0008:  /* 6F   | (0A)00001B       */ callvirt   instance class [System.Data/* 23000004 */]System.Data.DataTable/* 01000005 */ [System.Data/* 23000004 */]System.Data.DataTableCollection/* 01000026 */::get_Item(int32) /* 0A00001B */
      IL_000d:  /* 28   | (06)00003F       */ call       instance void EmitPerfTesting.DataSetAdapter15WithInterface/* 02000008 */::Initialize(class [System.Data/* 23000004 */]System.Data.DataTable/* 01000005 */) /* 0600003F */
      IL_0012:  /* 2A   |                  */ ret
    } // end of method DataSetAdapter15WithInterface::Initialize

    .method /*0600003F*/ public hidebysig newslot virtual final 
            instance void  Initialize(class [System.Data/* 23000004 */]System.Data.DataTable/* 01000005 */ dt) cil managed
    // SIG: 20 01 01 12 15
    {
      // Method begins at RVA 0x3c64
      // Code size       346 (0x15a)
      .maxstack  5
      IL_0000:  /* 7E   | (04)000014       */ ldsfld     bool EmitPerfTesting.DataSetAdapter15WithInterface/* 02000008 */::isInitialized /* 04000014 */
      IL_0005:  /* 2C   | 01               */ brfalse.s  IL_0008

      IL_0007:  /* 2A   |                  */ ret

      IL_0008:  /* 03   |                  */ ldarg.1
      IL_0009:  /* 6F   | (0A)00002E       */ callvirt   instance class [System.Data/* 23000004 */]System.Data.DataColumnCollection/* 01000034 */ [System.Data/* 23000004 */]System.Data.DataTable/* 01000005 */::get_Columns() /* 0A00002E */
      IL_000e:  /* 6F   | (0A)00001A       */ callvirt   instance int32 [System.Data/* 23000004 */]System.Data.InternalDataCollectionBase/* 01000027 */::get_Count() /* 0A00001A */
      IL_0013:  /* 8D   | (01)000035       */ newarr     [mscorlib/* 23000001 */]System.Int32/* 01000035 */
      IL_0018:  /* 80   | (04)000015       */ stsfld     int32[] EmitPerfTesting.DataSetAdapter15WithInterface/* 02000008 */::rows /* 04000015 */
      IL_001d:  /* 7E   | (04)000015       */ ldsfld     int32[] EmitPerfTesting.DataSetAdapter15WithInterface/* 02000008 */::rows /* 04000015 */
      IL_0022:  /* 16   |                  */ ldc.i4.0
      IL_0023:  /* 03   |                  */ ldarg.1
      IL_0024:  /* 6F   | (0A)00002E       */ callvirt   instance class [System.Data/* 23000004 */]System.Data.DataColumnCollection/* 01000034 */ [System.Data/* 23000004 */]System.Data.DataTable/* 01000005 */::get_Columns() /* 0A00002E */
      IL_0029:  /* 72   | (70)000134       */ ldstr      "Address" /* 70000134 */
      IL_002e:  /* 6F   | (0A)00002F       */ callvirt   instance class [System.Data/* 23000004 */]System.Data.DataColumn/* 01000036 */ [System.Data/* 23000004 */]System.Data.DataColumnCollection/* 01000034 */::get_Item(string) /* 0A00002F */
      IL_0033:  /* 6F   | (0A)000030       */ callvirt   instance int32 [System.Data/* 23000004 */]System.Data.DataColumn/* 01000036 */::get_Ordinal() /* 0A000030 */
      IL_0038:  /* 9E   |                  */ stelem.i4
      IL_0039:  /* 7E   | (04)000015       */ ldsfld     int32[] EmitPerfTesting.DataSetAdapter15WithInterface/* 02000008 */::rows /* 04000015 */
      IL_003e:  /* 17   |                  */ ldc.i4.1
      IL_003f:  /* 03   |                  */ ldarg.1
      IL_0040:  /* 6F   | (0A)00002E       */ callvirt   instance class [System.Data/* 23000004 */]System.Data.DataColumnCollection/* 01000034 */ [System.Data/* 23000004 */]System.Data.DataTable/* 01000005 */::get_Columns() /* 0A00002E */
      IL_0045:  /* 72   | (70)000144       */ ldstr      "City" /* 70000144 */
      IL_004a:  /* 6F   | (0A)00002F       */ callvirt   instance class [System.Data/* 23000004 */]System.Data.DataColumn/* 01000036 */ [System.Data/* 23000004 */]System.Data.DataColumnCollection/* 01000034 */::get_Item(string) /* 0A00002F */
      IL_004f:  /* 6F   | (0A)000030       */ callvirt   instance int32 [System.Data/* 23000004 */]System.Data.DataColumn/* 01000036 */::get_Ordinal() /* 0A000030 */
      IL_0054:  /* 9E   |                  */ stelem.i4
      IL_0055:  /* 7E   | (04)000015       */ ldsfld     int32[] EmitPerfTesting.DataSetAdapter15WithInterface/* 02000008 */::rows /* 04000015 */
      IL_005a:  /* 18   |                  */ ldc.i4.2
      IL_005b:  /* 03   |                  */ ldarg.1
      IL_005c:  /* 6F   | (0A)00002E       */ callvirt   instance class [System.Data/* 23000004 */]System.Data.DataColumnCollection/* 01000034 */ [System.Data/* 23000004 */]System.Data.DataTable/* 01000005 */::get_Columns() /* 0A00002E */
      IL_0061:  /* 72   | (70)00014E       */ ldstr      "CompanyName" /* 7000014E */
      IL_0066:  /* 6F   | (0A)00002F       */ callvirt   instance class [System.Data/* 23000004 */]System.Data.DataColumn/* 01000036 */ [System.Data/* 23000004 */]System.Data.DataColumnCollection/* 01000034 */::get_Item(string) /* 0A00002F */
      IL_006b:  /* 6F   | (0A)000030       */ callvirt   instance int32 [System.Data/* 23000004 */]System.Data.DataColumn/* 01000036 */::get_Ordinal() /* 0A000030 */
      IL_0070:  /* 9E   |                  */ stelem.i4
      IL_0071:  /* 7E   | (04)000015       */ ldsfld     int32[] EmitPerfTesting.DataSetAdapter15WithInterface/* 02000008 */::rows /* 04000015 */
      IL_0076:  /* 19   |                  */ ldc.i4.3
      IL_0077:  /* 03   |                  */ ldarg.1
      IL_0078:  /* 6F   | (0A)00002E       */ callvirt   instance class [System.Data/* 23000004 */]System.Data.DataColumnCollection/* 01000034 */ [System.Data/* 23000004 */]System.Data.DataTable/* 01000005 */::get_Columns() /* 0A00002E */
      IL_007d:  /* 72   | (70)000166       */ ldstr      "ContactName" /* 70000166 */
      IL_0082:  /* 6F   | (0A)00002F       */ callvirt   instance class [System.Data/* 23000004 */]System.Data.DataColumn/* 01000036 */ [System.Data/* 23000004 */]System.Data.DataColumnCollection/* 01000034 */::get_Item(string) /* 0A00002F */
      IL_0087:  /* 6F   | (0A)000030       */ callvirt   instance int32 [System.Data/* 23000004 */]System.Data.DataColumn/* 01000036 */::get_Ordinal() /* 0A000030 */
      IL_008c:  /* 9E   |                  */ stelem.i4
      IL_008d:  /* 7E   | (04)000015       */ ldsfld     int32[] EmitPerfTesting.DataSetAdapter15WithInterface/* 02000008 */::rows /* 04000015 */
      IL_0092:  /* 1A   |                  */ ldc.i4.4
      IL_0093:  /* 03   |                  */ ldarg.1
      IL_0094:  /* 6F   | (0A)00002E       */ callvirt   instance class [System.Data/* 23000004 */]System.Data.DataColumnCollection/* 01000034 */ [System.Data/* 23000004 */]System.Data.DataTable/* 01000005 */::get_Columns() /* 0A00002E */
      IL_0099:  /* 72   | (70)00017E       */ ldstr      "ContactTitle" /* 7000017E */
      IL_009e:  /* 6F   | (0A)00002F       */ callvirt   instance class [System.Data/* 23000004 */]System.Data.DataColumn/* 01000036 */ [System.Data/* 23000004 */]System.Data.DataColumnCollection/* 01000034 */::get_Item(string) /* 0A00002F */
      IL_00a3:  /* 6F   | (0A)000030       */ callvirt   instance int32 [System.Data/* 23000004 */]System.Data.DataColumn/* 01000036 */::get_Ordinal() /* 0A000030 */
      IL_00a8:  /* 9E   |                  */ stelem.i4
      IL_00a9:  /* 7E   | (04)000015       */ ldsfld     int32[] EmitPerfTesting.DataSetAdapter15WithInterface/* 02000008 */::rows /* 04000015 */
      IL_00ae:  /* 1B   |                  */ ldc.i4.5
      IL_00af:  /* 03   |                  */ ldarg.1
      IL_00b0:  /* 6F   | (0A)00002E       */ callvirt   instance class [System.Data/* 23000004 */]System.Data.DataColumnCollection/* 01000034 */ [System.Data/* 23000004 */]System.Data.DataTable/* 01000005 */::get_Columns() /* 0A00002E */
      IL_00b5:  /* 72   | (70)000198       */ ldstr      "Country" /* 70000198 */
      IL_00ba:  /* 6F   | (0A)00002F       */ callvirt   instance class [System.Data/* 23000004 */]System.Data.DataColumn/* 01000036 */ [System.Data/* 23000004 */]System.Data.DataColumnCollection/* 01000034 */::get_Item(string) /* 0A00002F */
      IL_00bf:  /* 6F   | (0A)000030       */ callvirt   instance int32 [System.Data/* 23000004 */]System.Data.DataColumn/* 01000036 */::get_Ordinal() /* 0A000030 */
      IL_00c4:  /* 9E   |                  */ stelem.i4
      IL_00c5:  /* 7E   | (04)000015       */ ldsfld     int32[] EmitPerfTesting.DataSetAdapter15WithInterface/* 02000008 */::rows /* 04000015 */
      IL_00ca:  /* 1C   |                  */ ldc.i4.6
      IL_00cb:  /* 03   |                  */ ldarg.1
      IL_00cc:  /* 6F   | (0A)00002E       */ callvirt   instance class [System.Data/* 23000004 */]System.Data.DataColumnCollection/* 01000034 */ [System.Data/* 23000004 */]System.Data.DataTable/* 01000005 */::get_Columns() /* 0A00002E */
      IL_00d1:  /* 72   | (70)0001A8       */ ldstr      "CustomerId" /* 700001A8 */
      IL_00d6:  /* 6F   | (0A)00002F       */ callvirt   instance class [System.Data/* 23000004 */]System.Data.DataColumn/* 01000036 */ [System.Data/* 23000004 */]System.Data.DataColumnCollection/* 01000034 */::get_Item(string) /* 0A00002F */
      IL_00db:  /* 6F   | (0A)000030       */ callvirt   instance int32 [System.Data/* 23000004 */]System.Data.DataColumn/* 01000036 */::get_Ordinal() /* 0A000030 */
      IL_00e0:  /* 9E   |                  */ stelem.i4
      IL_00e1:  /* 7E   | (04)000015       */ ldsfld     int32[] EmitPerfTesting.DataSetAdapter15WithInterface/* 02000008 */::rows /* 04000015 */
      IL_00e6:  /* 1D   |                  */ ldc.i4.7
      IL_00e7:  /* 03   |                  */ ldarg.1
      IL_00e8:  /* 6F   | (0A)00002E       */ callvirt   instance class [System.Data/* 23000004 */]System.Data.DataColumnCollection/* 01000034 */ [System.Data/* 23000004 */]System.Data.DataTable/* 01000005 */::get_Columns() /* 0A00002E */
      IL_00ed:  /* 72   | (70)0001BE       */ ldstr      "Fax" /* 700001BE */
      IL_00f2:  /* 6F   | (0A)00002F       */ callvirt   instance class [System.Data/* 23000004 */]System.Data.DataColumn/* 01000036 */ [System.Data/* 23000004 */]System.Data.DataColumnCollection/* 01000034 */::get_Item(string) /* 0A00002F */
      IL_00f7:  /* 6F   | (0A)000030       */ callvirt   instance int32 [System.Data/* 23000004 */]System.Data.DataColumn/* 01000036 */::get_Ordinal() /* 0A000030 */
      IL_00fc:  /* 9E   |                  */ stelem.i4
      IL_00fd:  /* 7E   | (04)000015       */ ldsfld     int32[] EmitPerfTesting.DataSetAdapter15WithInterface/* 02000008 */::rows /* 04000015 */
      IL_0102:  /* 1E   |                  */ ldc.i4.8
      IL_0103:  /* 03   |                  */ ldarg.1
      IL_0104:  /* 6F   | (0A)00002E       */ callvirt   instance class [System.Data/* 23000004 */]System.Data.DataColumnCollection/* 01000034 */ [System.Data/* 23000004 */]System.Data.DataTable/* 01000005 */::get_Columns() /* 0A00002E */
      IL_0109:  /* 72   | (70)0001C6       */ ldstr      "Phone" /* 700001C6 */
      IL_010e:  /* 6F   | (0A)00002F       */ callvirt   instance class [System.Data/* 23000004 */]System.Data.DataColumn/* 01000036 */ [System.Data/* 23000004 */]System.Data.DataColumnCollection/* 01000034 */::get_Item(string) /* 0A00002F */
      IL_0113:  /* 6F   | (0A)000030       */ callvirt   instance int32 [System.Data/* 23000004 */]System.Data.DataColumn/* 01000036 */::get_Ordinal() /* 0A000030 */
      IL_0118:  /* 9E   |                  */ stelem.i4
      IL_0119:  /* 7E   | (04)000015       */ ldsfld     int32[] EmitPerfTesting.DataSetAdapter15WithInterface/* 02000008 */::rows /* 04000015 */
      IL_011e:  /* 1F   | 09               */ ldc.i4.s   9
      IL_0120:  /* 03   |                  */ ldarg.1
      IL_0121:  /* 6F   | (0A)00002E       */ callvirt   instance class [System.Data/* 23000004 */]System.Data.DataColumnCollection/* 01000034 */ [System.Data/* 23000004 */]System.Data.DataTable/* 01000005 */::get_Columns() /* 0A00002E */
      IL_0126:  /* 72   | (70)0001D2       */ ldstr      "PostalCode" /* 700001D2 */
      IL_012b:  /* 6F   | (0A)00002F       */ callvirt   instance class [System.Data/* 23000004 */]System.Data.DataColumn/* 01000036 */ [System.Data/* 23000004 */]System.Data.DataColumnCollection/* 01000034 */::get_Item(string) /* 0A00002F */
      IL_0130:  /* 6F   | (0A)000030       */ callvirt   instance int32 [System.Data/* 23000004 */]System.Data.DataColumn/* 01000036 */::get_Ordinal() /* 0A000030 */
      IL_0135:  /* 9E   |                  */ stelem.i4
      IL_0136:  /* 7E   | (04)000015       */ ldsfld     int32[] EmitPerfTesting.DataSetAdapter15WithInterface/* 02000008 */::rows /* 04000015 */
      IL_013b:  /* 1F   | 09               */ ldc.i4.s   9
      IL_013d:  /* 03   |                  */ ldarg.1
      IL_013e:  /* 6F   | (0A)00002E       */ callvirt   instance class [System.Data/* 23000004 */]System.Data.DataColumnCollection/* 01000034 */ [System.Data/* 23000004 */]System.Data.DataTable/* 01000005 */::get_Columns() /* 0A00002E */
      IL_0143:  /* 72   | (70)0001E8       */ ldstr      "Region" /* 700001E8 */
      IL_0148:  /* 6F   | (0A)00002F       */ callvirt   instance class [System.Data/* 23000004 */]System.Data.DataColumn/* 01000036 */ [System.Data/* 23000004 */]System.Data.DataColumnCollection/* 01000034 */::get_Item(string) /* 0A00002F */
      IL_014d:  /* 6F   | (0A)000030       */ callvirt   instance int32 [System.Data/* 23000004 */]System.Data.DataColumn/* 01000036 */::get_Ordinal() /* 0A000030 */
      IL_0152:  /* 9E   |                  */ stelem.i4
      IL_0153:  /* 17   |                  */ ldc.i4.1
      IL_0154:  /* 80   | (04)000014       */ stsfld     bool EmitPerfTesting.DataSetAdapter15WithInterface/* 02000008 */::isInitialized /* 04000014 */
      IL_0159:  /* 2A   |                  */ ret
    } // end of method DataSetAdapter15WithInterface::Initialize

    .method /*06000040*/ public hidebysig newslot virtual final 
            instance int32  GetOrdinal(string colName) cil managed
    // SIG: 20 01 08 0E
    {
      // Method begins at RVA 0x3dcc
      // Code size       244 (0xf4)
      .maxstack  2
      IL_0000:  /* 03   |                  */ ldarg.1
      IL_0001:  /* 72   | (70)000134       */ ldstr      "Address" /* 70000134 */
      IL_0006:  /* 28   | (0A)000034       */ call       bool [mscorlib/* 23000001 */]System.String/* 0100002C */::op_Equality(string,
                                                                                                                               string) /* 0A000034 */
      IL_000b:  /* 2C   | 08               */ brfalse.s  IL_0015

      IL_000d:  /* 7E   | (04)000015       */ ldsfld     int32[] EmitPerfTesting.DataSetAdapter15WithInterface/* 02000008 */::rows /* 04000015 */
      IL_0012:  /* 16   |                  */ ldc.i4.0
      IL_0013:  /* 94   |                  */ ldelem.i4
      IL_0014:  /* 2A   |                  */ ret

      IL_0015:  /* 03   |                  */ ldarg.1
      IL_0016:  /* 72   | (70)000144       */ ldstr      "City" /* 70000144 */
      IL_001b:  /* 28   | (0A)000034       */ call       bool [mscorlib/* 23000001 */]System.String/* 0100002C */::op_Equality(string,
                                                                                                                               string) /* 0A000034 */
      IL_0020:  /* 2C   | 08               */ brfalse.s  IL_002a

      IL_0022:  /* 7E   | (04)000015       */ ldsfld     int32[] EmitPerfTesting.DataSetAdapter15WithInterface/* 02000008 */::rows /* 04000015 */
      IL_0027:  /* 17   |                  */ ldc.i4.1
      IL_0028:  /* 94   |                  */ ldelem.i4
      IL_0029:  /* 2A   |                  */ ret

      IL_002a:  /* 03   |                  */ ldarg.1
      IL_002b:  /* 72   | (70)00014E       */ ldstr      "CompanyName" /* 7000014E */
      IL_0030:  /* 28   | (0A)000034       */ call       bool [mscorlib/* 23000001 */]System.String/* 0100002C */::op_Equality(string,
                                                                                                                               string) /* 0A000034 */
      IL_0035:  /* 2C   | 08               */ brfalse.s  IL_003f

      IL_0037:  /* 7E   | (04)000015       */ ldsfld     int32[] EmitPerfTesting.DataSetAdapter15WithInterface/* 02000008 */::rows /* 04000015 */
      IL_003c:  /* 18   |                  */ ldc.i4.2
      IL_003d:  /* 94   |                  */ ldelem.i4
      IL_003e:  /* 2A   |                  */ ret

      IL_003f:  /* 03   |                  */ ldarg.1
      IL_0040:  /* 72   | (70)000166       */ ldstr      "ContactName" /* 70000166 */
      IL_0045:  /* 28   | (0A)000034       */ call       bool [mscorlib/* 23000001 */]System.String/* 0100002C */::op_Equality(string,
                                                                                                                               string) /* 0A000034 */
      IL_004a:  /* 2C   | 08               */ brfalse.s  IL_0054

      IL_004c:  /* 7E   | (04)000015       */ ldsfld     int32[] EmitPerfTesting.DataSetAdapter15WithInterface/* 02000008 */::rows /* 04000015 */
      IL_0051:  /* 19   |                  */ ldc.i4.3
      IL_0052:  /* 94   |                  */ ldelem.i4
      IL_0053:  /* 2A   |                  */ ret

      IL_0054:  /* 03   |                  */ ldarg.1
      IL_0055:  /* 72   | (70)00017E       */ ldstr      "ContactTitle" /* 7000017E */
      IL_005a:  /* 28   | (0A)000034       */ call       bool [mscorlib/* 23000001 */]System.String/* 0100002C */::op_Equality(string,
                                                                                                                               string) /* 0A000034 */
      IL_005f:  /* 2C   | 08               */ brfalse.s  IL_0069

      IL_0061:  /* 7E   | (04)000015       */ ldsfld     int32[] EmitPerfTesting.DataSetAdapter15WithInterface/* 02000008 */::rows /* 04000015 */
      IL_0066:  /* 1A   |                  */ ldc.i4.4
      IL_0067:  /* 94   |                  */ ldelem.i4
      IL_0068:  /* 2A   |                  */ ret

      IL_0069:  /* 03   |                  */ ldarg.1
      IL_006a:  /* 72   | (70)000198       */ ldstr      "Country" /* 70000198 */
      IL_006f:  /* 28   | (0A)000034       */ call       bool [mscorlib/* 23000001 */]System.String/* 0100002C */::op_Equality(string,
                                                                                                                               string) /* 0A000034 */
      IL_0074:  /* 2C   | 08               */ brfalse.s  IL_007e

      IL_0076:  /* 7E   | (04)000015       */ ldsfld     int32[] EmitPerfTesting.DataSetAdapter15WithInterface/* 02000008 */::rows /* 04000015 */
      IL_007b:  /* 1B   |                  */ ldc.i4.5
      IL_007c:  /* 94   |                  */ ldelem.i4
      IL_007d:  /* 2A   |                  */ ret

      IL_007e:  /* 03   |                  */ ldarg.1
      IL_007f:  /* 72   | (70)0001A8       */ ldstr      "CustomerId" /* 700001A8 */
      IL_0084:  /* 28   | (0A)000034       */ call       bool [mscorlib/* 23000001 */]System.String/* 0100002C */::op_Equality(string,
                                                                                                                               string) /* 0A000034 */
      IL_0089:  /* 2C   | 08               */ brfalse.s  IL_0093

      IL_008b:  /* 7E   | (04)000015       */ ldsfld     int32[] EmitPerfTesting.DataSetAdapter15WithInterface/* 02000008 */::rows /* 04000015 */
      IL_0090:  /* 1C   |                  */ ldc.i4.6
      IL_0091:  /* 94   |                  */ ldelem.i4
      IL_0092:  /* 2A   |                  */ ret

      IL_0093:  /* 03   |                  */ ldarg.1
      IL_0094:  /* 72   | (70)0001BE       */ ldstr      "Fax" /* 700001BE */
      IL_0099:  /* 28   | (0A)000034       */ call       bool [mscorlib/* 23000001 */]System.String/* 0100002C */::op_Equality(string,
                                                                                                                               string) /* 0A000034 */
      IL_009e:  /* 2C   | 08               */ brfalse.s  IL_00a8

      IL_00a0:  /* 7E   | (04)000015       */ ldsfld     int32[] EmitPerfTesting.DataSetAdapter15WithInterface/* 02000008 */::rows /* 04000015 */
      IL_00a5:  /* 1D   |                  */ ldc.i4.7
      IL_00a6:  /* 94   |                  */ ldelem.i4
      IL_00a7:  /* 2A   |                  */ ret

      IL_00a8:  /* 03   |                  */ ldarg.1
      IL_00a9:  /* 72   | (70)0001C6       */ ldstr      "Phone" /* 700001C6 */
      IL_00ae:  /* 28   | (0A)000034       */ call       bool [mscorlib/* 23000001 */]System.String/* 0100002C */::op_Equality(string,
                                                                                                                               string) /* 0A000034 */
      IL_00b3:  /* 2C   | 08               */ brfalse.s  IL_00bd

      IL_00b5:  /* 7E   | (04)000015       */ ldsfld     int32[] EmitPerfTesting.DataSetAdapter15WithInterface/* 02000008 */::rows /* 04000015 */
      IL_00ba:  /* 1E   |                  */ ldc.i4.8
      IL_00bb:  /* 94   |                  */ ldelem.i4
      IL_00bc:  /* 2A   |                  */ ret

      IL_00bd:  /* 03   |                  */ ldarg.1
      IL_00be:  /* 72   | (70)0001D2       */ ldstr      "PostalCode" /* 700001D2 */
      IL_00c3:  /* 28   | (0A)000034       */ call       bool [mscorlib/* 23000001 */]System.String/* 0100002C */::op_Equality(string,
                                                                                                                               string) /* 0A000034 */
      IL_00c8:  /* 2C   | 09               */ brfalse.s  IL_00d3

      IL_00ca:  /* 7E   | (04)000015       */ ldsfld     int32[] EmitPerfTesting.DataSetAdapter15WithInterface/* 02000008 */::rows /* 04000015 */
      IL_00cf:  /* 1F   | 09               */ ldc.i4.s   9
      IL_00d1:  /* 94   |                  */ ldelem.i4
      IL_00d2:  /* 2A   |                  */ ret

      IL_00d3:  /* 03   |                  */ ldarg.1
      IL_00d4:  /* 72   | (70)0001E8       */ ldstr      "Region" /* 700001E8 */
      IL_00d9:  /* 28   | (0A)000034       */ call       bool [mscorlib/* 23000001 */]System.String/* 0100002C */::op_Equality(string,
                                                                                                                               string) /* 0A000034 */
      IL_00de:  /* 2C   | 09               */ brfalse.s  IL_00e9

      IL_00e0:  /* 7E   | (04)000015       */ ldsfld     int32[] EmitPerfTesting.DataSetAdapter15WithInterface/* 02000008 */::rows /* 04000015 */
      IL_00e5:  /* 1F   | 0A               */ ldc.i4.s   10
      IL_00e7:  /* 94   |                  */ ldelem.i4
      IL_00e8:  /* 2A   |                  */ ret

      IL_00e9:  /* 72   | (70)0001F6       */ ldstr      "Column not found" /* 700001F6 */
      IL_00ee:  /* 73   | (0A)00001D       */ newobj     instance void [mscorlib/* 23000001 */]System.ApplicationException/* 01000029 */::.ctor(string) /* 0A00001D */
      IL_00f3:  /* 7A   |                  */ throw
    } // end of method DataSetAdapter15WithInterface::GetOrdinal

    .method /*06000041*/ private hidebysig specialname rtspecialname static 
            void  .cctor() cil managed
    // SIG: 00 00 01
    {
      // Method begins at RVA 0x3ecc
      // Code size       13 (0xd)
      .maxstack  1
      IL_0000:  /* 16   |                  */ ldc.i4.0
      IL_0001:  /* 80   | (04)000014       */ stsfld     bool EmitPerfTesting.DataSetAdapter15WithInterface/* 02000008 */::isInitialized /* 04000014 */
      IL_0006:  /* 14   |                  */ ldnull
      IL_0007:  /* 80   | (04)000015       */ stsfld     int32[] EmitPerfTesting.DataSetAdapter15WithInterface/* 02000008 */::rows /* 04000015 */
      IL_000c:  /* 2A   |                  */ ret
    } // end of method DataSetAdapter15WithInterface::.cctor

  } // end of class DataSetAdapter15WithInterface

By viewing downloads associated with this article you agree to the Terms of Service and the article's licence.

If a file you wish to view isn't highlighted, and is a text file (not binary), please let us know and we'll add colourisation support for it.

License

This article, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

Share

About the Author

jconwell
United States United States
I have been a professional developer since 1996. My experience comes from many different industries; Data Mining Software, Consulting, E-Commerce, Wholesale Operations, Clinical Software, Insurance, Energy.

I started programming in the military, trying to find better ways to analyze database data, eventually automating my entire job. Later, in college, I automated my way out of another job. This gave me the great idea to switch majors to the only thing that seemed natural…Programming!

You may also be interested in...

| Advertise | Privacy | Terms of Use | Mobile
Web02 | 2.8.160730.1 | Last Updated 1 May 2006
Article Copyright 2006 by jconwell
Everything else Copyright © CodeProject, 1999-2016
Layout: fixed | fluid