Skapa objekt med data dynamiskt med ExpandoObject

När man arbetar med dynamic i .NET 4.0 så tar man ett befintligt objekt och säger att man vill använda vissa metoder eller egenskaper som finns för det objektet. Det laddas anropas sedan under runtime. Om objektet inte har de metoder som finns så får man under runtime ett fel om det, trots att allt kompilerade utan problem.

Så hur gör vi nu om vi vill skapa ett dynamiskt objekt och berätta för det vilka egenskaper och värden som finns samt till dela dem värden för att sedan anropa dem?

I .NET 4.0 under System.Dynamic så finns det ett objekt för detta, kallat ExpandoObject. Det är ett helt tomt objekt utan några egenskaper eller metoder som helst förutom de vanliga Equals(), GetHashCode(), GetType() och ToString(). Det implementerar dock ett antal interfaces, vilka används internt för att hålla reda på de metoder vi lägger på det dynamiska objektet: IDynamicMetaObjectProvider, IDictionary<string, Object>, ICollection<KeyValuePair<string, Object>>, IEnumerable<KeyValuePair<string, Object>> och IEnumerable.

När vi använder ExpandoObject så kan vi skapa instansen som vanligt:

ExpandoObject o = new ExpandoObject(); 

Det här gör dock att vi star där med en instans av ett object som inte kan göra något förutom att visa att det är ett ExpandoObject, ingen höjdare alltså.

Vi kan däremot skapa en dynamisk instans av detta objekt, och då lägga på några metoder.

dynamic magic = new ExpandoObject();
 
magic.IntX = 10;
magic.IntY = 20;
magic.Name = "Nisse";
magic.SayHello = new Action<string>(x => Console.WriteLine("Hello, " + x + "!"));
magic.Multiply = new Func<int, int, int>((x, y) => x * y);

Här har vi skapat en dynamisk instans av ett ExpandoObject, och säger att vi har ett antal metoder och egenskaper som ska finnas på det objektet.

Om det här hade varit en instans av ett vanligt objekt så hade vi fått ett runtime-fel som sager att metoderna inte finns för objektet. Det naturliga vore om detsamma gäller för detta objekt, så vi lägger till de här raderna under:

Console.WriteLine("X: {0}", magic.IntX);
Console.WriteLine("Y: {0}", magic.IntY);
Console.WriteLine("Name: {0}", magic.Name);
Console.WriteLine("Multiply(X, Y): {0}", magic.Multiply(magic.IntX, magic.IntY));
magic.SayHello(magic.Name);

När vi nu startar igång programmet så ser vi att vi inte alls fick något fel, utan istället det här:

1 - Console

Vi har alltså skapat upp ett dynamiskt objekt och tilldelat det metoder och egenskaper, på precis samma sätt som vi hade gjort med ett dynamiskt språk som JavaScript eller IronRuby, trots att det är ett statiskt språk vi arbetar med!

Så hur går det till? Som jag nämnde tidigare så implementerar ExpandoObject ett antal interfaces som används för collections. När vi tilldelar vårt objekt egenskaper med dess värden så lagras dessa i collections internt i objektet, och plockas sedan fram när vi anropar dem.

Om vi debuggar så ser vi att vi får upp detta:

2 - Debug Dynamic View

I Visual Studio 2010 så finns det en ny visualizer som används för att visa vad som finns i dynamiska vyer som denna. Vi kan här se att det har skapats olika metoder för vårt objekt med antingen datan vi har skickat in, eller de delegater som används (Action<string> och Func<int, int, int>).

Om vi går ännu djupare så kan vi se att det i vårt objekt finns en Dictionary<string, object> som håller reda på våra objekt:

3 - Dictionary

Vi kan enkelt se alla nycklar:

4 - Keys

Och värden:

5 - Values

Om vi analyserar IL-koden så kan vi se att Action<> och Func<> har skrivits om till vanliga void.

SayHello:

.method private hidebysig static void <Main>b__12(string x) cil managed
{
    .custom instance void [mscorlib]System.Runtime.CompilerServices.CompilerGeneratedAttribute::.ctor()
    .maxstack 8
    L_0000: ldstr "Hello, "
    L_0005: ldarg.0 
    L_0006: ldstr "!"
    L_000b: call string [mscorlib]System.String::Concat(string, string, string)
    L_0010: call void [mscorlib]System.Console::WriteLine(string)
    L_0015: nop 
    L_0016: ret 
}
 
.field private static class [mscorlib]System.Action`1<string> CS$<>9__CachedAnonymousMethodDelegate14
{
    .custom instance void [mscorlib]System.Runtime.CompilerServices.CompilerGeneratedAttribute::.ctor()
}

Multiply:

.method private hidebysig static int32 <Main>b__13(int32 x, int32 y) cil managed
{
    .custom instance void [mscorlib]System.Runtime.CompilerServices.CompilerGeneratedAttribute::.ctor()
    .maxstack 2
    .locals init (
        [0] int32 CS$1$0000)
    L_0000: ldarg.0 
    L_0001: ldarg.1 
    L_0002: mul 
    L_0003: stloc.0 
    L_0004: br.s L_0006
    L_0006: ldloc.0 
    L_0007: ret 
}
 
.field private static class [mscorlib]System.Func`3<int32, int32, int32> CS$<>9__CachedAnonymousMethodDelegate15
{
    .custom instance void [mscorlib]System.Runtime.CompilerServices.CompilerGeneratedAttribute::.ctor()
}

Det är inga konstigheter här, utan vid kompilering så sker detta alltid automatiskt.

Därememot så är Main-metoden mer intressant.

.method private hidebysig static void Main(string[] args) cil managed
{
    .entrypoint
    .maxstack 15
    .locals init (
        [0] object magic,
        [1] class [Microsoft.CSharp]Microsoft.CSharp.RuntimeBinder.CSharpArgumentInfo[] CS$0$0000)
    L_0000: nop 
    L_0001: newobj instance void [System.Core]System.Dynamic.ExpandoObject::.ctor()
    L_0006: stloc.0 
    L_0007: ldsfld class [System.Core]System.Runtime.CompilerServices.CallSite`1<class [mscorlib]System.Func`4<class [System.Core]System.Runtime.CompilerServices.CallSite, object, int32, object>> ExpandoObjectTesting.Program/<Main>o__SiteContainer0::<>p__Site1
    L_000c: brtrue.s L_004a
    L_000e: ldstr "IntX"
    L_0013: ldtoken ExpandoObjectTesting.Program
    L_0018: call class [mscorlib]System.Type [mscorlib]System.Type::GetTypeFromHandle(valuetype [mscorlib]System.RuntimeTypeHandle)
    L_001d: ldc.i4.2 
    L_001e: newarr [Microsoft.CSharp]Microsoft.CSharp.RuntimeBinder.CSharpArgumentInfo
    L_0023: stloc.1 
    L_0024: ldloc.1 
    L_0025: ldc.i4.0 
    L_0026: ldc.i4.0 
    L_0027: ldnull 
    L_0028: newobj instance void [Microsoft.CSharp]Microsoft.CSharp.RuntimeBinder.CSharpArgumentInfo::.ctor(valuetype [Microsoft.CSharp]Microsoft.CSharp.RuntimeBinder.CSharpArgumentInfoFlags, string)
    L_002d: stelem.ref 
    L_002e: ldloc.1 
    L_002f: ldc.i4.1 
    L_0030: ldc.i4.3 
    L_0031: ldnull 
    L_0032: newobj instance void [Microsoft.CSharp]Microsoft.CSharp.RuntimeBinder.CSharpArgumentInfo::.ctor(valuetype [Microsoft.CSharp]Microsoft.CSharp.RuntimeBinder.CSharpArgumentInfoFlags, string)
    L_0037: stelem.ref 
    L_0038: ldloc.1 
    L_0039: newobj instance void [Microsoft.CSharp]Microsoft.CSharp.RuntimeBinder.CSharpSetMemberBinder::.ctor(string, class [mscorlib]System.Type, class [mscorlib]System.Collections.Generic.IEnumerable`1<class [Microsoft.CSharp]Microsoft.CSharp.RuntimeBinder.CSharpArgumentInfo>)
    L_003e: call class [System.Core]System.Runtime.CompilerServices.CallSite`1<!0> [System.Core]System.Runtime.CompilerServices.CallSite`1<class [mscorlib]System.Func`4<class [System.Core]System.Runtime.CompilerServices.CallSite, object, int32, object>>::Create(class [System.Core]System.Runtime.CompilerServices.CallSiteBinder)
    L_0043: stsfld class [System.Core]System.Runtime.CompilerServices.CallSite`1<class [mscorlib]System.Func`4<class [System.Core]System.Runtime.CompilerServices.CallSite, object, int32, object>> ExpandoObjectTesting.Program/<Main>o__SiteContainer0::<>p__Site1
    L_0048: br.s L_004a
    L_004a: ldsfld class [System.Core]System.Runtime.CompilerServices.CallSite`1<class [mscorlib]System.Func`4<class [System.Core]System.Runtime.CompilerServices.CallSite, object, int32, object>> ExpandoObjectTesting.Program/<Main>o__SiteContainer0::<>p__Site1
    L_004f: ldfld !0 [System.Core]System.Runtime.CompilerServices.CallSite`1<class [mscorlib]System.Func`4<class [System.Core]System.Runtime.CompilerServices.CallSite, object, int32, object>>::Target
    L_0054: ldsfld class [System.Core]System.Runtime.CompilerServices.CallSite`1<class [mscorlib]System.Func`4<class [System.Core]System.Runtime.CompilerServices.CallSite, object, int32, object>> ExpandoObjectTesting.Program/<Main>o__SiteContainer0::<>p__Site1
    L_0059: ldloc.0 
    L_005a: ldc.i4.s 10
    L_005c: callvirt instance !3 [mscorlib]System.Func`4<class [System.Core]System.Runtime.CompilerServices.CallSite, object, int32, object>::Invoke(!0, !1, !2)
    L_0061: pop 
    L_0062: ldsfld class [System.Core]System.Runtime.CompilerServices.CallSite`1<class [mscorlib]System.Func`4<class [System.Core]System.Runtime.CompilerServices.CallSite, object, int32, object>> ExpandoObjectTesting.Program/<Main>o__SiteContainer0::<>p__Site2
    L_0067: brtrue.s L_00a5
    L_0069: ldstr "IntY"
    L_006e: ldtoken ExpandoObjectTesting.Program
    L_0073: call class [mscorlib]System.Type [mscorlib]System.Type::GetTypeFromHandle(valuetype [mscorlib]System.RuntimeTypeHandle)
    L_0078: ldc.i4.2 
    L_0079: newarr [Microsoft.CSharp]Microsoft.CSharp.RuntimeBinder.CSharpArgumentInfo
    L_007e: stloc.1 
    L_007f: ldloc.1 
    L_0080: ldc.i4.0 
    L_0081: ldc.i4.0 
    L_0082: ldnull 
    L_0083: newobj instance void [Microsoft.CSharp]Microsoft.CSharp.RuntimeBinder.CSharpArgumentInfo::.ctor(valuetype [Microsoft.CSharp]Microsoft.CSharp.RuntimeBinder.CSharpArgumentInfoFlags, string)
    L_0088: stelem.ref 
    L_0089: ldloc.1 
    L_008a: ldc.i4.1 
    L_008b: ldc.i4.3 
    L_008c: ldnull 
    L_008d: newobj instance void [Microsoft.CSharp]Microsoft.CSharp.RuntimeBinder.CSharpArgumentInfo::.ctor(valuetype [Microsoft.CSharp]Microsoft.CSharp.RuntimeBinder.CSharpArgumentInfoFlags, string)
    L_0092: stelem.ref 
    L_0093: ldloc.1 
    L_0094: newobj instance void [Microsoft.CSharp]Microsoft.CSharp.RuntimeBinder.CSharpSetMemberBinder::.ctor(string, class [mscorlib]System.Type, class [mscorlib]System.Collections.Generic.IEnumerable`1<class [Microsoft.CSharp]Microsoft.CSharp.RuntimeBinder.CSharpArgumentInfo>)
    L_0099: call class [System.Core]System.Runtime.CompilerServices.CallSite`1<!0> [System.Core]System.Runtime.CompilerServices.CallSite`1<class [mscorlib]System.Func`4<class [System.Core]System.Runtime.CompilerServices.CallSite, object, int32, object>>::Create(class [System.Core]System.Runtime.CompilerServices.CallSiteBinder)
    L_009e: stsfld class [System.Core]System.Runtime.CompilerServices.CallSite`1<class [mscorlib]System.Func`4<class [System.Core]System.Runtime.CompilerServices.CallSite, object, int32, object>> ExpandoObjectTesting.Program/<Main>o__SiteContainer0::<>p__Site2
    L_00a3: br.s L_00a5
    L_00a5: ldsfld class [System.Core]System.Runtime.CompilerServices.CallSite`1<class [mscorlib]System.Func`4<class [System.Core]System.Runtime.CompilerServices.CallSite, object, int32, object>> ExpandoObjectTesting.Program/<Main>o__SiteContainer0::<>p__Site2
    L_00aa: ldfld !0 [System.Core]System.Runtime.CompilerServices.CallSite`1<class [mscorlib]System.Func`4<class [System.Core]System.Runtime.CompilerServices.CallSite, object, int32, object>>::Target
    L_00af: ldsfld class [System.Core]System.Runtime.CompilerServices.CallSite`1<class [mscorlib]System.Func`4<class [System.Core]System.Runtime.CompilerServices.CallSite, object, int32, object>> ExpandoObjectTesting.Program/<Main>o__SiteContainer0::<>p__Site2
    L_00b4: ldloc.0 
    L_00b5: ldc.i4.s 20
    L_00b7: callvirt instance !3 [mscorlib]System.Func`4<class [System.Core]System.Runtime.CompilerServices.CallSite, object, int32, object>::Invoke(!0, !1, !2)
    L_00bc: pop 
    L_00bd: ldsfld class [System.Core]System.Runtime.CompilerServices.CallSite`1<class [mscorlib]System.Func`4<class [System.Core]System.Runtime.CompilerServices.CallSite, object, string, object>> ExpandoObjectTesting.Program/<Main>o__SiteContainer0::<>p__Site3
    L_00c2: brtrue.s L_0100
    L_00c4: ldstr "Name"
    L_00c9: ldtoken ExpandoObjectTesting.Program
    L_00ce: call class [mscorlib]System.Type [mscorlib]System.Type::GetTypeFromHandle(valuetype [mscorlib]System.RuntimeTypeHandle)
    L_00d3: ldc.i4.2 
    L_00d4: newarr [Microsoft.CSharp]Microsoft.CSharp.RuntimeBinder.CSharpArgumentInfo
    L_00d9: stloc.1 
    L_00da: ldloc.1 
    L_00db: ldc.i4.0 
    L_00dc: ldc.i4.0 
    L_00dd: ldnull 
    L_00de: newobj instance void [Microsoft.CSharp]Microsoft.CSharp.RuntimeBinder.CSharpArgumentInfo::.ctor(valuetype [Microsoft.CSharp]Microsoft.CSharp.RuntimeBinder.CSharpArgumentInfoFlags, string)
    L_00e3: stelem.ref 
    L_00e4: ldloc.1 
    L_00e5: ldc.i4.1 
    L_00e6: ldc.i4.3 
    L_00e7: ldnull 
    L_00e8: newobj instance void [Microsoft.CSharp]Microsoft.CSharp.RuntimeBinder.CSharpArgumentInfo::.ctor(valuetype [Microsoft.CSharp]Microsoft.CSharp.RuntimeBinder.CSharpArgumentInfoFlags, string)
    L_00ed: stelem.ref 
    L_00ee: ldloc.1 
    L_00ef: newobj instance void [Microsoft.CSharp]Microsoft.CSharp.RuntimeBinder.CSharpSetMemberBinder::.ctor(string, class [mscorlib]System.Type, class [mscorlib]System.Collections.Generic.IEnumerable`1<class [Microsoft.CSharp]Microsoft.CSharp.RuntimeBinder.CSharpArgumentInfo>)
    L_00f4: call class [System.Core]System.Runtime.CompilerServices.CallSite`1<!0> [System.Core]System.Runtime.CompilerServices.CallSite`1<class [mscorlib]System.Func`4<class [System.Core]System.Runtime.CompilerServices.CallSite, object, string, object>>::Create(class [System.Core]System.Runtime.CompilerServices.CallSiteBinder)
    L_00f9: stsfld class [System.Core]System.Runtime.CompilerServices.CallSite`1<class [mscorlib]System.Func`4<class [System.Core]System.Runtime.CompilerServices.CallSite, object, string, object>> ExpandoObjectTesting.Program/<Main>o__SiteContainer0::<>p__Site3
    L_00fe: br.s L_0100
    L_0100: ldsfld class [System.Core]System.Runtime.CompilerServices.CallSite`1<class [mscorlib]System.Func`4<class [System.Core]System.Runtime.CompilerServices.CallSite, object, string, object>> ExpandoObjectTesting.Program/<Main>o__SiteContainer0::<>p__Site3
    L_0105: ldfld !0 [System.Core]System.Runtime.CompilerServices.CallSite`1<class [mscorlib]System.Func`4<class [System.Core]System.Runtime.CompilerServices.CallSite, object, string, object>>::Target
    L_010a: ldsfld class [System.Core]System.Runtime.CompilerServices.CallSite`1<class [mscorlib]System.Func`4<class [System.Core]System.Runtime.CompilerServices.CallSite, object, string, object>> ExpandoObjectTesting.Program/<Main>o__SiteContainer0::<>p__Site3
    L_010f: ldloc.0 
    L_0110: ldstr "Nisse"
    L_0115: callvirt instance !3 [mscorlib]System.Func`4<class [System.Core]System.Runtime.CompilerServices.CallSite, object, string, object>::Invoke(!0, !1, !2)
    L_011a: pop 
    L_011b: ldsfld class [System.Core]System.Runtime.CompilerServices.CallSite`1<class [mscorlib]System.Func`4<class [System.Core]System.Runtime.CompilerServices.CallSite, object, class [mscorlib]System.Action`1<string>, object>> ExpandoObjectTesting.Program/<Main>o__SiteContainer0::<>p__Site4
    L_0120: brtrue.s L_015e
    L_0122: ldstr "SayHello"
    L_0127: ldtoken ExpandoObjectTesting.Program
    L_012c: call class [mscorlib]System.Type [mscorlib]System.Type::GetTypeFromHandle(valuetype [mscorlib]System.RuntimeTypeHandle)
    L_0131: ldc.i4.2 
    L_0132: newarr [Microsoft.CSharp]Microsoft.CSharp.RuntimeBinder.CSharpArgumentInfo
    L_0137: stloc.1 
    L_0138: ldloc.1 
    L_0139: ldc.i4.0 
    L_013a: ldc.i4.0 
    L_013b: ldnull 
    L_013c: newobj instance void [Microsoft.CSharp]Microsoft.CSharp.RuntimeBinder.CSharpArgumentInfo::.ctor(valuetype [Microsoft.CSharp]Microsoft.CSharp.RuntimeBinder.CSharpArgumentInfoFlags, string)
    L_0141: stelem.ref 
    L_0142: ldloc.1 
    L_0143: ldc.i4.1 
    L_0144: ldc.i4.1 
    L_0145: ldnull 
    L_0146: newobj instance void [Microsoft.CSharp]Microsoft.CSharp.RuntimeBinder.CSharpArgumentInfo::.ctor(valuetype [Microsoft.CSharp]Microsoft.CSharp.RuntimeBinder.CSharpArgumentInfoFlags, string)
    L_014b: stelem.ref 
    L_014c: ldloc.1 
    L_014d: newobj instance void [Microsoft.CSharp]Microsoft.CSharp.RuntimeBinder.CSharpSetMemberBinder::.ctor(string, class [mscorlib]System.Type, class [mscorlib]System.Collections.Generic.IEnumerable`1<class [Microsoft.CSharp]Microsoft.CSharp.RuntimeBinder.CSharpArgumentInfo>)
    L_0152: call class [System.Core]System.Runtime.CompilerServices.CallSite`1<!0> [System.Core]System.Runtime.CompilerServices.CallSite`1<class [mscorlib]System.Func`4<class [System.Core]System.Runtime.CompilerServices.CallSite, object, class [mscorlib]System.Action`1<string>, object>>::Create(class [System.Core]System.Runtime.CompilerServices.CallSiteBinder)
    L_0157: stsfld class [System.Core]System.Runtime.CompilerServices.CallSite`1<class [mscorlib]System.Func`4<class [System.Core]System.Runtime.CompilerServices.CallSite, object, class [mscorlib]System.Action`1<string>, object>> ExpandoObjectTesting.Program/<Main>o__SiteContainer0::<>p__Site4
    L_015c: br.s L_015e
    L_015e: ldsfld class [System.Core]System.Runtime.CompilerServices.CallSite`1<class [mscorlib]System.Func`4<class [System.Core]System.Runtime.CompilerServices.CallSite, object, class [mscorlib]System.Action`1<string>, object>> ExpandoObjectTesting.Program/<Main>o__SiteContainer0::<>p__Site4
    L_0163: ldfld !0 [System.Core]System.Runtime.CompilerServices.CallSite`1<class [mscorlib]System.Func`4<class [System.Core]System.Runtime.CompilerServices.CallSite, object, class [mscorlib]System.Action`1<string>, object>>::Target
    L_0168: ldsfld class [System.Core]System.Runtime.CompilerServices.CallSite`1<class [mscorlib]System.Func`4<class [System.Core]System.Runtime.CompilerServices.CallSite, object, class [mscorlib]System.Action`1<string>, object>> ExpandoObjectTesting.Program/<Main>o__SiteContainer0::<>p__Site4
    L_016d: ldloc.0 
    L_016e: ldsfld class [mscorlib]System.Action`1<string> ExpandoObjectTesting.Program::CS$<>9__CachedAnonymousMethodDelegate14
    L_0173: brtrue.s L_0188
    L_0175: ldnull 
    L_0176: ldftn void ExpandoObjectTesting.Program::<Main>b__12(string)
    L_017c: newobj instance void [mscorlib]System.Action`1<string>::.ctor(object, native int)
    L_0181: stsfld class [mscorlib]System.Action`1<string> ExpandoObjectTesting.Program::CS$<>9__CachedAnonymousMethodDelegate14
    L_0186: br.s L_0188
    L_0188: ldsfld class [mscorlib]System.Action`1<string> ExpandoObjectTesting.Program::CS$<>9__CachedAnonymousMethodDelegate14
    L_018d: callvirt instance !3 [mscorlib]System.Func`4<class [System.Core]System.Runtime.CompilerServices.CallSite, object, class [mscorlib]System.Action`1<string>, object>::Invoke(!0, !1, !2)
    L_0192: pop 
    L_0193: ldsfld class [System.Core]System.Runtime.CompilerServices.CallSite`1<class [mscorlib]System.Func`4<class [System.Core]System.Runtime.CompilerServices.CallSite, object, class [mscorlib]System.Func`3<int32, int32, int32>, object>> ExpandoObjectTesting.Program/<Main>o__SiteContainer0::<>p__Site5
    L_0198: brtrue.s L_01d6
    L_019a: ldstr "Multiply"
    L_019f: ldtoken ExpandoObjectTesting.Program
    L_01a4: call class [mscorlib]System.Type [mscorlib]System.Type::GetTypeFromHandle(valuetype [mscorlib]System.RuntimeTypeHandle)
    L_01a9: ldc.i4.2 
    L_01aa: newarr [Microsoft.CSharp]Microsoft.CSharp.RuntimeBinder.CSharpArgumentInfo
    L_01af: stloc.1 
    L_01b0: ldloc.1 
    L_01b1: ldc.i4.0 
    L_01b2: ldc.i4.0 
    L_01b3: ldnull 
    L_01b4: newobj instance void [Microsoft.CSharp]Microsoft.CSharp.RuntimeBinder.CSharpArgumentInfo::.ctor(valuetype [Microsoft.CSharp]Microsoft.CSharp.RuntimeBinder.CSharpArgumentInfoFlags, string)
    L_01b9: stelem.ref 
    L_01ba: ldloc.1 
    L_01bb: ldc.i4.1 
    L_01bc: ldc.i4.1 
    L_01bd: ldnull 
    L_01be: newobj instance void [Microsoft.CSharp]Microsoft.CSharp.RuntimeBinder.CSharpArgumentInfo::.ctor(valuetype [Microsoft.CSharp]Microsoft.CSharp.RuntimeBinder.CSharpArgumentInfoFlags, string)
    L_01c3: stelem.ref 
    L_01c4: ldloc.1 
    L_01c5: newobj instance void [Microsoft.CSharp]Microsoft.CSharp.RuntimeBinder.CSharpSetMemberBinder::.ctor(string, class [mscorlib]System.Type, class [mscorlib]System.Collections.Generic.IEnumerable`1<class [Microsoft.CSharp]Microsoft.CSharp.RuntimeBinder.CSharpArgumentInfo>)
    L_01ca: call class [System.Core]System.Runtime.CompilerServices.CallSite`1<!0> [System.Core]System.Runtime.CompilerServices.CallSite`1<class [mscorlib]System.Func`4<class [System.Core]System.Runtime.CompilerServices.CallSite, object, class [mscorlib]System.Func`3<int32, int32, int32>, object>>::Create(class [System.Core]System.Runtime.CompilerServices.CallSiteBinder)
    L_01cf: stsfld class [System.Core]System.Runtime.CompilerServices.CallSite`1<class [mscorlib]System.Func`4<class [System.Core]System.Runtime.CompilerServices.CallSite, object, class [mscorlib]System.Func`3<int32, int32, int32>, object>> ExpandoObjectTesting.Program/<Main>o__SiteContainer0::<>p__Site5
    L_01d4: br.s L_01d6
    L_01d6: ldsfld class [System.Core]System.Runtime.CompilerServices.CallSite`1<class [mscorlib]System.Func`4<class [System.Core]System.Runtime.CompilerServices.CallSite, object, class [mscorlib]System.Func`3<int32, int32, int32>, object>> ExpandoObjectTesting.Program/<Main>o__SiteContainer0::<>p__Site5
    L_01db: ldfld !0 [System.Core]System.Runtime.CompilerServices.CallSite`1<class [mscorlib]System.Func`4<class [System.Core]System.Runtime.CompilerServices.CallSite, object, class [mscorlib]System.Func`3<int32, int32, int32>, object>>::Target
    L_01e0: ldsfld class [System.Core]System.Runtime.CompilerServices.CallSite`1<class [mscorlib]System.Func`4<class [System.Core]System.Runtime.CompilerServices.CallSite, object, class [mscorlib]System.Func`3<int32, int32, int32>, object>> ExpandoObjectTesting.Program/<Main>o__SiteContainer0::<>p__Site5
    L_01e5: ldloc.0 
    L_01e6: ldsfld class [mscorlib]System.Func`3<int32, int32, int32> ExpandoObjectTesting.Program::CS$<>9__CachedAnonymousMethodDelegate15
    L_01eb: brtrue.s L_0200
    L_01ed: ldnull 
    L_01ee: ldftn int32 ExpandoObjectTesting.Program::<Main>b__13(int32, int32)
    L_01f4: newobj instance void [mscorlib]System.Func`3<int32, int32, int32>::.ctor(object, native int)
    L_01f9: stsfld class [mscorlib]System.Func`3<int32, int32, int32> ExpandoObjectTesting.Program::CS$<>9__CachedAnonymousMethodDelegate15
    L_01fe: br.s L_0200
    L_0200: ldsfld class [mscorlib]System.Func`3<int32, int32, int32> ExpandoObjectTesting.Program::CS$<>9__CachedAnonymousMethodDelegate15
    L_0205: callvirt instance !3 [mscorlib]System.Func`4<class [System.Core]System.Runtime.CompilerServices.CallSite, object, class [mscorlib]System.Func`3<int32, int32, int32>, object>::Invoke(!0, !1, !2)
    L_020a: pop 
    L_020b: ldsfld class [System.Core]System.Runtime.CompilerServices.CallSite`1<class [mscorlib]System.Action`4<class [System.Core]System.Runtime.CompilerServices.CallSite, class [mscorlib]System.Type, string, object>> ExpandoObjectTesting.Program/<Main>o__SiteContainer0::<>p__Site6
    L_0210: brtrue.s L_025b
    L_0212: ldc.i4.0 
    L_0213: ldstr "WriteLine"
    L_0218: ldtoken ExpandoObjectTesting.Program
    L_021d: call class [mscorlib]System.Type [mscorlib]System.Type::GetTypeFromHandle(valuetype [mscorlib]System.RuntimeTypeHandle)
    L_0222: ldnull 
    L_0223: ldc.i4.3 
    L_0224: newarr [Microsoft.CSharp]Microsoft.CSharp.RuntimeBinder.CSharpArgumentInfo
    L_0229: stloc.1 
    L_022a: ldloc.1 
    L_022b: ldc.i4.0 
    L_022c: ldc.i4.s 0x21
    L_022e: ldnull 
    L_022f: newobj instance void [Microsoft.CSharp]Microsoft.CSharp.RuntimeBinder.CSharpArgumentInfo::.ctor(valuetype [Microsoft.CSharp]Microsoft.CSharp.RuntimeBinder.CSharpArgumentInfoFlags, string)
    L_0234: stelem.ref 
    L_0235: ldloc.1 
    L_0236: ldc.i4.1 
    L_0237: ldc.i4.3 
    L_0238: ldnull 
    L_0239: newobj instance void [Microsoft.CSharp]Microsoft.CSharp.RuntimeBinder.CSharpArgumentInfo::.ctor(valuetype [Microsoft.CSharp]Microsoft.CSharp.RuntimeBinder.CSharpArgumentInfoFlags, string)
    L_023e: stelem.ref 
    L_023f: ldloc.1 
    L_0240: ldc.i4.2 
    L_0241: ldc.i4.0 
    L_0242: ldnull 
    L_0243: newobj instance void [Microsoft.CSharp]Microsoft.CSharp.RuntimeBinder.CSharpArgumentInfo::.ctor(valuetype [Microsoft.CSharp]Microsoft.CSharp.RuntimeBinder.CSharpArgumentInfoFlags, string)
    L_0248: stelem.ref 
    L_0249: ldloc.1 
    L_024a: newobj instance void [Microsoft.CSharp]Microsoft.CSharp.RuntimeBinder.CSharpInvokeMemberBinder::.ctor(valuetype [Microsoft.CSharp]Microsoft.CSharp.RuntimeBinder.CSharpCallFlags, string, class [mscorlib]System.Type, class [mscorlib]System.Collections.Generic.IEnumerable`1<class [mscorlib]System.Type>, class [mscorlib]System.Collections.Generic.IEnumerable`1<class [Microsoft.CSharp]Microsoft.CSharp.RuntimeBinder.CSharpArgumentInfo>)
    L_024f: call class [System.Core]System.Runtime.CompilerServices.CallSite`1<!0> [System.Core]System.Runtime.CompilerServices.CallSite`1<class [mscorlib]System.Action`4<class [System.Core]System.Runtime.CompilerServices.CallSite, class [mscorlib]System.Type, string, object>>::Create(class [System.Core]System.Runtime.CompilerServices.CallSiteBinder)
    L_0254: stsfld class [System.Core]System.Runtime.CompilerServices.CallSite`1<class [mscorlib]System.Action`4<class [System.Core]System.Runtime.CompilerServices.CallSite, class [mscorlib]System.Type, string, object>> ExpandoObjectTesting.Program/<Main>o__SiteContainer0::<>p__Site6
    L_0259: br.s L_025b
    L_025b: ldsfld class [System.Core]System.Runtime.CompilerServices.CallSite`1<class [mscorlib]System.Action`4<class [System.Core]System.Runtime.CompilerServices.CallSite, class [mscorlib]System.Type, string, object>> ExpandoObjectTesting.Program/<Main>o__SiteContainer0::<>p__Site6
    L_0260: ldfld !0 [System.Core]System.Runtime.CompilerServices.CallSite`1<class [mscorlib]System.Action`4<class [System.Core]System.Runtime.CompilerServices.CallSite, class [mscorlib]System.Type, string, object>>::Target
    L_0265: ldsfld class [System.Core]System.Runtime.CompilerServices.CallSite`1<class [mscorlib]System.Action`4<class [System.Core]System.Runtime.CompilerServices.CallSite, class [mscorlib]System.Type, string, object>> ExpandoObjectTesting.Program/<Main>o__SiteContainer0::<>p__Site6
    L_026a: ldtoken [mscorlib]System.Console
    L_026f: call class [mscorlib]System.Type [mscorlib]System.Type::GetTypeFromHandle(valuetype [mscorlib]System.RuntimeTypeHandle)
    L_0274: ldstr "X: {0}"
    L_0279: ldsfld class [System.Core]System.Runtime.CompilerServices.CallSite`1<class [mscorlib]System.Func`3<class [System.Core]System.Runtime.CompilerServices.CallSite, object, object>> ExpandoObjectTesting.Program/<Main>o__SiteContainer0::<>p__Site7
    L_027e: brtrue.s L_02b2
    L_0280: ldstr "IntX"
    L_0285: ldtoken ExpandoObjectTesting.Program
    L_028a: call class [mscorlib]System.Type [mscorlib]System.Type::GetTypeFromHandle(valuetype [mscorlib]System.RuntimeTypeHandle)
    L_028f: ldc.i4.1 
    L_0290: newarr [Microsoft.CSharp]Microsoft.CSharp.RuntimeBinder.CSharpArgumentInfo
    L_0295: stloc.1 
    L_0296: ldloc.1 
    L_0297: ldc.i4.0 
    L_0298: ldc.i4.0 
    L_0299: ldnull 
    L_029a: newobj instance void [Microsoft.CSharp]Microsoft.CSharp.RuntimeBinder.CSharpArgumentInfo::.ctor(valuetype [Microsoft.CSharp]Microsoft.CSharp.RuntimeBinder.CSharpArgumentInfoFlags, string)
    L_029f: stelem.ref 
    L_02a0: ldloc.1 
    L_02a1: newobj instance void [Microsoft.CSharp]Microsoft.CSharp.RuntimeBinder.CSharpGetMemberBinder::.ctor(string, class [mscorlib]System.Type, class [mscorlib]System.Collections.Generic.IEnumerable`1<class [Microsoft.CSharp]Microsoft.CSharp.RuntimeBinder.CSharpArgumentInfo>)
    L_02a6: call class [System.Core]System.Runtime.CompilerServices.CallSite`1<!0> [System.Core]System.Runtime.CompilerServices.CallSite`1<class [mscorlib]System.Func`3<class [System.Core]System.Runtime.CompilerServices.CallSite, object, object>>::Create(class [System.Core]System.Runtime.CompilerServices.CallSiteBinder)
    L_02ab: stsfld class [System.Core]System.Runtime.CompilerServices.CallSite`1<class [mscorlib]System.Func`3<class [System.Core]System.Runtime.CompilerServices.CallSite, object, object>> ExpandoObjectTesting.Program/<Main>o__SiteContainer0::<>p__Site7
    L_02b0: br.s L_02b2
    L_02b2: ldsfld class [System.Core]System.Runtime.CompilerServices.CallSite`1<class [mscorlib]System.Func`3<class [System.Core]System.Runtime.CompilerServices.CallSite, object, object>> ExpandoObjectTesting.Program/<Main>o__SiteContainer0::<>p__Site7
    L_02b7: ldfld !0 [System.Core]System.Runtime.CompilerServices.CallSite`1<class [mscorlib]System.Func`3<class [System.Core]System.Runtime.CompilerServices.CallSite, object, object>>::Target
    L_02bc: ldsfld class [System.Core]System.Runtime.CompilerServices.CallSite`1<class [mscorlib]System.Func`3<class [System.Core]System.Runtime.CompilerServices.CallSite, object, object>> ExpandoObjectTesting.Program/<Main>o__SiteContainer0::<>p__Site7
    L_02c1: ldloc.0 
    L_02c2: callvirt instance !2 [mscorlib]System.Func`3<class [System.Core]System.Runtime.CompilerServices.CallSite, object, object>::Invoke(!0, !1)
    L_02c7: callvirt instance void [mscorlib]System.Action`4<class [System.Core]System.Runtime.CompilerServices.CallSite, class [mscorlib]System.Type, string, object>::Invoke(!0, !1, !2, !3)
    L_02cc: nop 
    L_02cd: ldsfld class [System.Core]System.Runtime.CompilerServices.CallSite`1<class [mscorlib]System.Action`4<class [System.Core]System.Runtime.CompilerServices.CallSite, class [mscorlib]System.Type, string, object>> ExpandoObjectTesting.Program/<Main>o__SiteContainer0::<>p__Site8
    L_02d2: brtrue.s L_031d
    L_02d4: ldc.i4.0 
    L_02d5: ldstr "WriteLine"
    L_02da: ldtoken ExpandoObjectTesting.Program
    L_02df: call class [mscorlib]System.Type [mscorlib]System.Type::GetTypeFromHandle(valuetype [mscorlib]System.RuntimeTypeHandle)
    L_02e4: ldnull 
    L_02e5: ldc.i4.3 
    L_02e6: newarr [Microsoft.CSharp]Microsoft.CSharp.RuntimeBinder.CSharpArgumentInfo
    L_02eb: stloc.1 
    L_02ec: ldloc.1 
    L_02ed: ldc.i4.0 
    L_02ee: ldc.i4.s 0x21
    L_02f0: ldnull 
    L_02f1: newobj instance void [Microsoft.CSharp]Microsoft.CSharp.RuntimeBinder.CSharpArgumentInfo::.ctor(valuetype [Microsoft.CSharp]Microsoft.CSharp.RuntimeBinder.CSharpArgumentInfoFlags, string)
    L_02f6: stelem.ref 
    L_02f7: ldloc.1 
    L_02f8: ldc.i4.1 
    L_02f9: ldc.i4.3 
    L_02fa: ldnull 
    L_02fb: newobj instance void [Microsoft.CSharp]Microsoft.CSharp.RuntimeBinder.CSharpArgumentInfo::.ctor(valuetype [Microsoft.CSharp]Microsoft.CSharp.RuntimeBinder.CSharpArgumentInfoFlags, string)
    L_0300: stelem.ref 
    L_0301: ldloc.1 
    L_0302: ldc.i4.2 
    L_0303: ldc.i4.0 
    L_0304: ldnull 
    L_0305: newobj instance void [Microsoft.CSharp]Microsoft.CSharp.RuntimeBinder.CSharpArgumentInfo::.ctor(valuetype [Microsoft.CSharp]Microsoft.CSharp.RuntimeBinder.CSharpArgumentInfoFlags, string)
    L_030a: stelem.ref 
    L_030b: ldloc.1 
    L_030c: newobj instance void [Microsoft.CSharp]Microsoft.CSharp.RuntimeBinder.CSharpInvokeMemberBinder::.ctor(valuetype [Microsoft.CSharp]Microsoft.CSharp.RuntimeBinder.CSharpCallFlags, string, class [mscorlib]System.Type, class [mscorlib]System.Collections.Generic.IEnumerable`1<class [mscorlib]System.Type>, class [mscorlib]System.Collections.Generic.IEnumerable`1<class [Microsoft.CSharp]Microsoft.CSharp.RuntimeBinder.CSharpArgumentInfo>)
    L_0311: call class [System.Core]System.Runtime.CompilerServices.CallSite`1<!0> [System.Core]System.Runtime.CompilerServices.CallSite`1<class [mscorlib]System.Action`4<class [System.Core]System.Runtime.CompilerServices.CallSite, class [mscorlib]System.Type, string, object>>::Create(class [System.Core]System.Runtime.CompilerServices.CallSiteBinder)
    L_0316: stsfld class [System.Core]System.Runtime.CompilerServices.CallSite`1<class [mscorlib]System.Action`4<class [System.Core]System.Runtime.CompilerServices.CallSite, class [mscorlib]System.Type, string, object>> ExpandoObjectTesting.Program/<Main>o__SiteContainer0::<>p__Site8
    L_031b: br.s L_031d
    L_031d: ldsfld class [System.Core]System.Runtime.CompilerServices.CallSite`1<class [mscorlib]System.Action`4<class [System.Core]System.Runtime.CompilerServices.CallSite, class [mscorlib]System.Type, string, object>> ExpandoObjectTesting.Program/<Main>o__SiteContainer0::<>p__Site8
    L_0322: ldfld !0 [System.Core]System.Runtime.CompilerServices.CallSite`1<class [mscorlib]System.Action`4<class [System.Core]System.Runtime.CompilerServices.CallSite, class [mscorlib]System.Type, string, object>>::Target
    L_0327: ldsfld class [System.Core]System.Runtime.CompilerServices.CallSite`1<class [mscorlib]System.Action`4<class [System.Core]System.Runtime.CompilerServices.CallSite, class [mscorlib]System.Type, string, object>> ExpandoObjectTesting.Program/<Main>o__SiteContainer0::<>p__Site8
    L_032c: ldtoken [mscorlib]System.Console
    L_0331: call class [mscorlib]System.Type [mscorlib]System.Type::GetTypeFromHandle(valuetype [mscorlib]System.RuntimeTypeHandle)
    L_0336: ldstr "Y: {0}"
    L_033b: ldsfld class [System.Core]System.Runtime.CompilerServices.CallSite`1<class [mscorlib]System.Func`3<class [System.Core]System.Runtime.CompilerServices.CallSite, object, object>> ExpandoObjectTesting.Program/<Main>o__SiteContainer0::<>p__Site9
    L_0340: brtrue.s L_0374
    L_0342: ldstr "IntY"
    L_0347: ldtoken ExpandoObjectTesting.Program
    L_034c: call class [mscorlib]System.Type [mscorlib]System.Type::GetTypeFromHandle(valuetype [mscorlib]System.RuntimeTypeHandle)
    L_0351: ldc.i4.1 
    L_0352: newarr [Microsoft.CSharp]Microsoft.CSharp.RuntimeBinder.CSharpArgumentInfo
    L_0357: stloc.1 
    L_0358: ldloc.1 
    L_0359: ldc.i4.0 
    L_035a: ldc.i4.0 
    L_035b: ldnull 
    L_035c: newobj instance void [Microsoft.CSharp]Microsoft.CSharp.RuntimeBinder.CSharpArgumentInfo::.ctor(valuetype [Microsoft.CSharp]Microsoft.CSharp.RuntimeBinder.CSharpArgumentInfoFlags, string)
    L_0361: stelem.ref 
    L_0362: ldloc.1 
    L_0363: newobj instance void [Microsoft.CSharp]Microsoft.CSharp.RuntimeBinder.CSharpGetMemberBinder::.ctor(string, class [mscorlib]System.Type, class [mscorlib]System.Collections.Generic.IEnumerable`1<class [Microsoft.CSharp]Microsoft.CSharp.RuntimeBinder.CSharpArgumentInfo>)
    L_0368: call class [System.Core]System.Runtime.CompilerServices.CallSite`1<!0> [System.Core]System.Runtime.CompilerServices.CallSite`1<class [mscorlib]System.Func`3<class [System.Core]System.Runtime.CompilerServices.CallSite, object, object>>::Create(class [System.Core]System.Runtime.CompilerServices.CallSiteBinder)
    L_036d: stsfld class [System.Core]System.Runtime.CompilerServices.CallSite`1<class [mscorlib]System.Func`3<class [System.Core]System.Runtime.CompilerServices.CallSite, object, object>> ExpandoObjectTesting.Program/<Main>o__SiteContainer0::<>p__Site9
    L_0372: br.s L_0374
    L_0374: ldsfld class [System.Core]System.Runtime.CompilerServices.CallSite`1<class [mscorlib]System.Func`3<class [System.Core]System.Runtime.CompilerServices.CallSite, object, object>> ExpandoObjectTesting.Program/<Main>o__SiteContainer0::<>p__Site9
    L_0379: ldfld !0 [System.Core]System.Runtime.CompilerServices.CallSite`1<class [mscorlib]System.Func`3<class [System.Core]System.Runtime.CompilerServices.CallSite, object, object>>::Target
    L_037e: ldsfld class [System.Core]System.Runtime.CompilerServices.CallSite`1<class [mscorlib]System.Func`3<class [System.Core]System.Runtime.CompilerServices.CallSite, object, object>> ExpandoObjectTesting.Program/<Main>o__SiteContainer0::<>p__Site9
    L_0383: ldloc.0 
    L_0384: callvirt instance !2 [mscorlib]System.Func`3<class [System.Core]System.Runtime.CompilerServices.CallSite, object, object>::Invoke(!0, !1)
    L_0389: callvirt instance void [mscorlib]System.Action`4<class [System.Core]System.Runtime.CompilerServices.CallSite, class [mscorlib]System.Type, string, object>::Invoke(!0, !1, !2, !3)
    L_038e: nop 
    L_038f: ldsfld class [System.Core]System.Runtime.CompilerServices.CallSite`1<class [mscorlib]System.Action`4<class [System.Core]System.Runtime.CompilerServices.CallSite, class [mscorlib]System.Type, string, object>> ExpandoObjectTesting.Program/<Main>o__SiteContainer0::<>p__Sitea
    L_0394: brtrue.s L_03df
    L_0396: ldc.i4.0 
    L_0397: ldstr "WriteLine"
    L_039c: ldtoken ExpandoObjectTesting.Program
    L_03a1: call class [mscorlib]System.Type [mscorlib]System.Type::GetTypeFromHandle(valuetype [mscorlib]System.RuntimeTypeHandle)
    L_03a6: ldnull 
    L_03a7: ldc.i4.3 
    L_03a8: newarr [Microsoft.CSharp]Microsoft.CSharp.RuntimeBinder.CSharpArgumentInfo
    L_03ad: stloc.1 
    L_03ae: ldloc.1 
    L_03af: ldc.i4.0 
    L_03b0: ldc.i4.s 0x21
    L_03b2: ldnull 
    L_03b3: newobj instance void [Microsoft.CSharp]Microsoft.CSharp.RuntimeBinder.CSharpArgumentInfo::.ctor(valuetype [Microsoft.CSharp]Microsoft.CSharp.RuntimeBinder.CSharpArgumentInfoFlags, string)
    L_03b8: stelem.ref 
    L_03b9: ldloc.1 
    L_03ba: ldc.i4.1 
    L_03bb: ldc.i4.3 
    L_03bc: ldnull 
    L_03bd: newobj instance void [Microsoft.CSharp]Microsoft.CSharp.RuntimeBinder.CSharpArgumentInfo::.ctor(valuetype [Microsoft.CSharp]Microsoft.CSharp.RuntimeBinder.CSharpArgumentInfoFlags, string)
    L_03c2: stelem.ref 
    L_03c3: ldloc.1 
    L_03c4: ldc.i4.2 
    L_03c5: ldc.i4.0 
L_03c6: ldnull 
    L_03c7: newobj instance void [Microsoft.CSharp]Microsoft.CSharp.RuntimeBinder.CSharpArgumentInfo::.ctor(valuetype [Microsoft.CSharp]Microsoft.CSharp.RuntimeBinder.CSharpArgumentInfoFlags, string)
    L_03cc: stelem.ref 
    L_03cd: ldloc.1 
    L_03ce: newobj instance void [Microsoft.CSharp]Microsoft.CSharp.RuntimeBinder.CSharpInvokeMemberBinder::.ctor(valuetype [Microsoft.CSharp]Microsoft.CSharp.RuntimeBinder.CSharpCallFlags, string, class [mscorlib]System.Type, class [mscorlib]System.Collections.Generic.IEnumerable`1<class [mscorlib]System.Type>, class [mscorlib]System.Collections.Generic.IEnumerable`1<class [Microsoft.CSharp]Microsoft.CSharp.RuntimeBinder.CSharpArgumentInfo>)
    L_03d3: call class [System.Core]System.Runtime.CompilerServices.CallSite`1<!0> [System.Core]System.Runtime.CompilerServices.CallSite`1<class [mscorlib]System.Action`4<class [System.Core]System.Runtime.CompilerServices.CallSite, class [mscorlib]System.Type, string, object>>::Create(class [System.Core]System.Runtime.CompilerServices.CallSiteBinder)
    L_03d8: stsfld class [System.Core]System.Runtime.CompilerServices.CallSite`1<class [mscorlib]System.Action`4<class [System.Core]System.Runtime.CompilerServices.CallSite, class [mscorlib]System.Type, string, object>> ExpandoObjectTesting.Program/<Main>o__SiteContainer0::<>p__Sitea
    L_03dd: br.s L_03df
    L_03df: ldsfld class [System.Core]System.Runtime.CompilerServices.CallSite`1<class [mscorlib]System.Action`4<class [System.Core]System.Runtime.CompilerServices.CallSite, class [mscorlib]System.Type, string, object>> ExpandoObjectTesting.Program/<Main>o__SiteContainer0::<>p__Sitea
    L_03e4: ldfld !0 [System.Core]System.Runtime.CompilerServices.CallSite`1<class [mscorlib]System.Action`4<class [System.Core]System.Runtime.CompilerServices.CallSite, class [mscorlib]System.Type, string, object>>::Target
    L_03e9: ldsfld class [System.Core]System.Runtime.CompilerServices.CallSite`1<class [mscorlib]System.Action`4<class [System.Core]System.Runtime.CompilerServices.CallSite, class [mscorlib]System.Type, string, object>> ExpandoObjectTesting.Program/<Main>o__SiteContainer0::<>p__Sitea
    L_03ee: ldtoken [mscorlib]System.Console
    L_03f3: call class [mscorlib]System.Type [mscorlib]System.Type::GetTypeFromHandle(valuetype [mscorlib]System.RuntimeTypeHandle)
    L_03f8: ldstr "Name: {0}"
    L_03fd: ldsfld class [System.Core]System.Runtime.CompilerServices.CallSite`1<class [mscorlib]System.Func`3<class [System.Core]System.Runtime.CompilerServices.CallSite, object, object>> ExpandoObjectTesting.Program/<Main>o__SiteContainer0::<>p__Siteb
    L_0402: brtrue.s L_0436
    L_0404: ldstr "Name"
    L_0409: ldtoken ExpandoObjectTesting.Program
    L_040e: call class [mscorlib]System.Type [mscorlib]System.Type::GetTypeFromHandle(valuetype [mscorlib]System.RuntimeTypeHandle)
    L_0413: ldc.i4.1 
    L_0414: newarr [Microsoft.CSharp]Microsoft.CSharp.RuntimeBinder.CSharpArgumentInfo
    L_0419: stloc.1 
    L_041a: ldloc.1 
    L_041b: ldc.i4.0 
    L_041c: ldc.i4.0 
    L_041d: ldnull 
    L_041e: newobj instance void [Microsoft.CSharp]Microsoft.CSharp.RuntimeBinder.CSharpArgumentInfo::.ctor(valuetype [Microsoft.CSharp]Microsoft.CSharp.RuntimeBinder.CSharpArgumentInfoFlags, string)
    L_0423: stelem.ref 
    L_0424: ldloc.1 
    L_0425: newobj instance void [Microsoft.CSharp]Microsoft.CSharp.RuntimeBinder.CSharpGetMemberBinder::.ctor(string, class [mscorlib]System.Type, class [mscorlib]System.Collections.Generic.IEnumerable`1<class [Microsoft.CSharp]Microsoft.CSharp.RuntimeBinder.CSharpArgumentInfo>)
    L_042a: call class [System.Core]System.Runtime.CompilerServices.CallSite`1<!0> [System.Core]System.Runtime.CompilerServices.CallSite`1<class [mscorlib]System.Func`3<class [System.Core]System.Runtime.CompilerServices.CallSite, object, object>>::Create(class [System.Core]System.Runtime.CompilerServices.CallSiteBinder)
    L_042f: stsfld class [System.Core]System.Runtime.CompilerServices.CallSite`1<class [mscorlib]System.Func`3<class [System.Core]System.Runtime.CompilerServices.CallSite, object, object>> ExpandoObjectTesting.Program/<Main>o__SiteContainer0::<>p__Siteb
    L_0434: br.s L_0436
    L_0436: ldsfld class [System.Core]System.Runtime.CompilerServices.CallSite`1<class [mscorlib]System.Func`3<class [System.Core]System.Runtime.CompilerServices.CallSite, object, object>> ExpandoObjectTesting.Program/<Main>o__SiteContainer0::<>p__Siteb
    L_043b: ldfld !0 [System.Core]System.Runtime.CompilerServices.CallSite`1<class [mscorlib]System.Func`3<class [System.Core]System.Runtime.CompilerServices.CallSite, object, object>>::Target
    L_0440: ldsfld class [System.Core]System.Runtime.CompilerServices.CallSite`1<class [mscorlib]System.Func`3<class [System.Core]System.Runtime.CompilerServices.CallSite, object, object>> ExpandoObjectTesting.Program/<Main>o__SiteContainer0::<>p__Siteb
    L_0445: ldloc.0 
    L_0446: callvirt instance !2 [mscorlib]System.Func`3<class [System.Core]System.Runtime.CompilerServices.CallSite, object, object>::Invoke(!0, !1)
    L_044b: callvirt instance void [mscorlib]System.Action`4<class [System.Core]System.Runtime.CompilerServices.CallSite, class [mscorlib]System.Type, string, object>::Invoke(!0, !1, !2, !3)
    L_0450: nop 
    L_0451: ldsfld class [System.Core]System.Runtime.CompilerServices.CallSite`1<class [mscorlib]System.Action`4<class [System.Core]System.Runtime.CompilerServices.CallSite, class [mscorlib]System.Type, string, object>> ExpandoObjectTesting.Program/<Main>o__SiteContainer0::<>p__Sitec
    L_0456: brtrue.s L_04a1
    L_0458: ldc.i4.0 
    L_0459: ldstr "WriteLine"
    L_045e: ldtoken ExpandoObjectTesting.Program
    L_0463: call class [mscorlib]System.Type [mscorlib]System.Type::GetTypeFromHandle(valuetype [mscorlib]System.RuntimeTypeHandle)
    L_0468: ldnull 
    L_0469: ldc.i4.3 
    L_046a: newarr [Microsoft.CSharp]Microsoft.CSharp.RuntimeBinder.CSharpArgumentInfo
    L_046f: stloc.1 
    L_0470: ldloc.1 
    L_0471: ldc.i4.0 
    L_0472: ldc.i4.s 0x21
    L_0474: ldnull 
    L_0475: newobj instance void [Microsoft.CSharp]Microsoft.CSharp.RuntimeBinder.CSharpArgumentInfo::.ctor(valuetype [Microsoft.CSharp]Microsoft.CSharp.RuntimeBinder.CSharpArgumentInfoFlags, string)
    L_047a: stelem.ref 
    L_047b: ldloc.1 
    L_047c: ldc.i4.1 
    L_047d: ldc.i4.3 
    L_047e: ldnull 
    L_047f: newobj instance void [Microsoft.CSharp]Microsoft.CSharp.RuntimeBinder.CSharpArgumentInfo::.ctor(valuetype [Microsoft.CSharp]Microsoft.CSharp.RuntimeBinder.CSharpArgumentInfoFlags, string)
    L_0484: stelem.ref 
    L_0485: ldloc.1 
    L_0486: ldc.i4.2 
    L_0487: ldc.i4.0 
    L_0488: ldnull 
    L_0489: newobj instance void [Microsoft.CSharp]Microsoft.CSharp.RuntimeBinder.CSharpArgumentInfo::.ctor(valuetype [Microsoft.CSharp]Microsoft.CSharp.RuntimeBinder.CSharpArgumentInfoFlags, string)
    L_048e: stelem.ref 
    L_048f: ldloc.1 
    L_0490: newobj instance void [Microsoft.CSharp]Microsoft.CSharp.RuntimeBinder.CSharpInvokeMemberBinder::.ctor(valuetype [Microsoft.CSharp]Microsoft.CSharp.RuntimeBinder.CSharpCallFlags, string, class [mscorlib]System.Type, class [mscorlib]System.Collections.Generic.IEnumerable`1<class [mscorlib]System.Type>, class [mscorlib]System.Collections.Generic.IEnumerable`1<class [Microsoft.CSharp]Microsoft.CSharp.RuntimeBinder.CSharpArgumentInfo>)
    L_0495: call class [System.Core]System.Runtime.CompilerServices.CallSite`1<!0> [System.Core]System.Runtime.CompilerServices.CallSite`1<class [mscorlib]System.Action`4<class [System.Core]System.Runtime.CompilerServices.CallSite, class [mscorlib]System.Type, string, object>>::Create(class [System.Core]System.Runtime.CompilerServices.CallSiteBinder)
    L_049a: stsfld class [System.Core]System.Runtime.CompilerServices.CallSite`1<class [mscorlib]System.Action`4<class [System.Core]System.Runtime.CompilerServices.CallSite, class [mscorlib]System.Type, string, object>> ExpandoObjectTesting.Program/<Main>o__SiteContainer0::<>p__Sitec
    L_049f: br.s L_04a1
    L_04a1: ldsfld class [System.Core]System.Runtime.CompilerServices.CallSite`1<class [mscorlib]System.Action`4<class [System.Core]System.Runtime.CompilerServices.CallSite, class [mscorlib]System.Type, string, object>> ExpandoObjectTesting.Program/<Main>o__SiteContainer0::<>p__Sitec
    L_04a6: ldfld !0 [System.Core]System.Runtime.CompilerServices.CallSite`1<class [mscorlib]System.Action`4<class [System.Core]System.Runtime.CompilerServices.CallSite, class [mscorlib]System.Type, string, object>>::Target
    L_04ab: ldsfld class [System.Core]System.Runtime.CompilerServices.CallSite`1<class [mscorlib]System.Action`4<class [System.Core]System.Runtime.CompilerServices.CallSite, class [mscorlib]System.Type, string, object>> ExpandoObjectTesting.Program/<Main>o__SiteContainer0::<>p__Sitec
    L_04b0: ldtoken [mscorlib]System.Console
    L_04b5: call class [mscorlib]System.Type [mscorlib]System.Type::GetTypeFromHandle(valuetype [mscorlib]System.RuntimeTypeHandle)
    L_04ba: ldstr "Multiply(X, Y): {0}"
    L_04bf: ldsfld class [System.Core]System.Runtime.CompilerServices.CallSite`1<class [mscorlib]System.Func`5<class [System.Core]System.Runtime.CompilerServices.CallSite, object, object, object, object>> ExpandoObjectTesting.Program/<Main>o__SiteContainer0::<>p__Sited
    L_04c4: brtrue.s L_050e
    L_04c6: ldc.i4.0 
    L_04c7: ldstr "Multiply"
    L_04cc: ldtoken ExpandoObjectTesting.Program
    L_04d1: call class [mscorlib]System.Type [mscorlib]System.Type::GetTypeFromHandle(valuetype [mscorlib]System.RuntimeTypeHandle)
    L_04d6: ldnull 
    L_04d7: ldc.i4.3 
    L_04d8: newarr [Microsoft.CSharp]Microsoft.CSharp.RuntimeBinder.CSharpArgumentInfo
    L_04dd: stloc.1 
    L_04de: ldloc.1 
    L_04df: ldc.i4.0 
    L_04e0: ldc.i4.0 
    L_04e1: ldnull 
    L_04e2: newobj instance void [Microsoft.CSharp]Microsoft.CSharp.RuntimeBinder.CSharpArgumentInfo::.ctor(valuetype [Microsoft.CSharp]Microsoft.CSharp.RuntimeBinder.CSharpArgumentInfoFlags, string)
    L_04e7: stelem.ref 
    L_04e8: ldloc.1 
    L_04e9: ldc.i4.1 
    L_04ea: ldc.i4.0 
    L_04eb: ldnull 
    L_04ec: newobj instance void [Microsoft.CSharp]Microsoft.CSharp.RuntimeBinder.CSharpArgumentInfo::.ctor(valuetype [Microsoft.CSharp]Microsoft.CSharp.RuntimeBinder.CSharpArgumentInfoFlags, string)
    L_04f1: stelem.ref 
    L_04f2: ldloc.1 
    L_04f3: ldc.i4.2 
    L_04f4: ldc.i4.0 
    L_04f5: ldnull 
    L_04f6: newobj instance void [Microsoft.CSharp]Microsoft.CSharp.RuntimeBinder.CSharpArgumentInfo::.ctor(valuetype [Microsoft.CSharp]Microsoft.CSharp.RuntimeBinder.CSharpArgumentInfoFlags, string)
    L_04fb: stelem.ref 
    L_04fc: ldloc.1 
    L_04fd: newobj instance void [Microsoft.CSharp]Microsoft.CSharp.RuntimeBinder.CSharpInvokeMemberBinder::.ctor(valuetype [Microsoft.CSharp]Microsoft.CSharp.RuntimeBinder.CSharpCallFlags, string, class [mscorlib]System.Type, class [mscorlib]System.Collections.Generic.IEnumerable`1<class [mscorlib]System.Type>, class [mscorlib]System.Collections.Generic.IEnumerable`1<class [Microsoft.CSharp]Microsoft.CSharp.RuntimeBinder.CSharpArgumentInfo>)
    L_0502: call class [System.Core]System.Runtime.CompilerServices.CallSite`1<!0> [System.Core]System.Runtime.CompilerServices.CallSite`1<class [mscorlib]System.Func`5<class [System.Core]System.Runtime.CompilerServices.CallSite, object, object, object, object>>::Create(class [System.Core]System.Runtime.CompilerServices.CallSiteBinder)
    L_0507: stsfld class [System.Core]System.Runtime.CompilerServices.CallSite`1<class [mscorlib]System.Func`5<class [System.Core]System.Runtime.CompilerServices.CallSite, object, object, object, object>> ExpandoObjectTesting.Program/<Main>o__SiteContainer0::<>p__Sited
    L_050c: br.s L_050e
    L_050e: ldsfld class [System.Core]System.Runtime.CompilerServices.CallSite`1<class [mscorlib]System.Func`5<class [System.Core]System.Runtime.CompilerServices.CallSite, object, object, object, object>> ExpandoObjectTesting.Program/<Main>o__SiteContainer0::<>p__Sited
    L_0513: ldfld !0 [System.Core]System.Runtime.CompilerServices.CallSite`1<class [mscorlib]System.Func`5<class [System.Core]System.Runtime.CompilerServices.CallSite, object, object, object, object>>::Target
    L_0518: ldsfld class [System.Core]System.Runtime.CompilerServices.CallSite`1<class [mscorlib]System.Func`5<class [System.Core]System.Runtime.CompilerServices.CallSite, object, object, object, object>> ExpandoObjectTesting.Program/<Main>o__SiteContainer0::<>p__Sited
    L_051d: ldloc.0 
    L_051e: ldsfld class [System.Core]System.Runtime.CompilerServices.CallSite`1<class [mscorlib]System.Func`3<class [System.Core]System.Runtime.CompilerServices.CallSite, object, object>> ExpandoObjectTesting.Program/<Main>o__SiteContainer0::<>p__Sitee
    L_0523: brtrue.s L_0557
    L_0525: ldstr "IntX"
    L_052a: ldtoken ExpandoObjectTesting.Program
    L_052f: call class [mscorlib]System.Type [mscorlib]System.Type::GetTypeFromHandle(valuetype [mscorlib]System.RuntimeTypeHandle)
    L_0534: ldc.i4.1 
    L_0535: newarr [Microsoft.CSharp]Microsoft.CSharp.RuntimeBinder.CSharpArgumentInfo
    L_053a: stloc.1 
    L_053b: ldloc.1 
    L_053c: ldc.i4.0 
    L_053d: ldc.i4.0 
    L_053e: ldnull 
    L_053f: newobj instance void [Microsoft.CSharp]Microsoft.CSharp.RuntimeBinder.CSharpArgumentInfo::.ctor(valuetype [Microsoft.CSharp]Microsoft.CSharp.RuntimeBinder.CSharpArgumentInfoFlags, string)
    L_0544: stelem.ref 
    L_0545: ldloc.1 
    L_0546: newobj instance void [Microsoft.CSharp]Microsoft.CSharp.RuntimeBinder.CSharpGetMemberBinder::.ctor(string, class [mscorlib]System.Type, class [mscorlib]System.Collections.Generic.IEnumerable`1<class [Microsoft.CSharp]Microsoft.CSharp.RuntimeBinder.CSharpArgumentInfo>)
    L_054b: call class [System.Core]System.Runtime.CompilerServices.CallSite`1<!0> [System.Core]System.Runtime.CompilerServices.CallSite`1<class [mscorlib]System.Func`3<class [System.Core]System.Runtime.CompilerServices.CallSite, object, object>>::Create(class [System.Core]System.Runtime.CompilerServices.CallSiteBinder)
    L_0550: stsfld class [System.Core]System.Runtime.CompilerServices.CallSite`1<class [mscorlib]System.Func`3<class [System.Core]System.Runtime.CompilerServices.CallSite, object, object>> ExpandoObjectTesting.Program/<Main>o__SiteContainer0::<>p__Sitee
    L_0555: br.s L_0557
    L_0557: ldsfld class [System.Core]System.Runtime.CompilerServices.CallSite`1<class [mscorlib]System.Func`3<class [System.Core]System.Runtime.CompilerServices.CallSite, object, object>> ExpandoObjectTesting.Program/<Main>o__SiteContainer0::<>p__Sitee
    L_055c: ldfld !0 [System.Core]System.Runtime.CompilerServices.CallSite`1<class [mscorlib]System.Func`3<class [System.Core]System.Runtime.CompilerServices.CallSite, object, object>>::Target
    L_0561: ldsfld class [System.Core]System.Runtime.CompilerServices.CallSite`1<class [mscorlib]System.Func`3<class [System.Core]System.Runtime.CompilerServices.CallSite, object, object>> ExpandoObjectTesting.Program/<Main>o__SiteContainer0::<>p__Sitee
    L_0566: ldloc.0 
    L_0567: callvirt instance !2 [mscorlib]System.Func`3<class [System.Core]System.Runtime.CompilerServices.CallSite, object, object>::Invoke(!0, !1)
    L_056c: ldsfld class [System.Core]System.Runtime.CompilerServices.CallSite`1<class [mscorlib]System.Func`3<class [System.Core]System.Runtime.CompilerServices.CallSite, object, object>> ExpandoObjectTesting.Program/<Main>o__SiteContainer0::<>p__Sitef
    L_0571: brtrue.s L_05a5
    L_0573: ldstr "IntY"
    L_0578: ldtoken ExpandoObjectTesting.Program
    L_057d: call class [mscorlib]System.Type [mscorlib]System.Type::GetTypeFromHandle(valuetype [mscorlib]System.RuntimeTypeHandle)
    L_0582: ldc.i4.1 
    L_0583: newarr [Microsoft.CSharp]Microsoft.CSharp.RuntimeBinder.CSharpArgumentInfo
    L_0588: stloc.1 
    L_0589: ldloc.1 
    L_058a: ldc.i4.0 
    L_058b: ldc.i4.0 
    L_058c: ldnull 
    L_058d: newobj instance void [Microsoft.CSharp]Microsoft.CSharp.RuntimeBinder.CSharpArgumentInfo::.ctor(valuetype [Microsoft.CSharp]Microsoft.CSharp.RuntimeBinder.CSharpArgumentInfoFlags, string)
    L_0592: stelem.ref 
    L_0593: ldloc.1 
    L_0594: newobj instance void [Microsoft.CSharp]Microsoft.CSharp.RuntimeBinder.CSharpGetMemberBinder::.ctor(string, class [mscorlib]System.Type, class [mscorlib]System.Collections.Generic.IEnumerable`1<class [Microsoft.CSharp]Microsoft.CSharp.RuntimeBinder.CSharpArgumentInfo>)
    L_0599: call class [System.Core]System.Runtime.CompilerServices.CallSite`1<!0> [System.Core]System.Runtime.CompilerServices.CallSite`1<class [mscorlib]System.Func`3<class [System.Core]System.Runtime.CompilerServices.CallSite, object, object>>::Create(class [System.Core]System.Runtime.CompilerServices.CallSiteBinder)
    L_059e: stsfld class [System.Core]System.Runtime.CompilerServices.CallSite`1<class [mscorlib]System.Func`3<class [System.Core]System.Runtime.CompilerServices.CallSite, object, object>> ExpandoObjectTesting.Program/<Main>o__SiteContainer0::<>p__Sitef
    L_05a3: br.s L_05a5
    L_05a5: ldsfld class [System.Core]System.Runtime.CompilerServices.CallSite`1<class [mscorlib]System.Func`3<class [System.Core]System.Runtime.CompilerServices.CallSite, object, object>> ExpandoObjectTesting.Program/<Main>o__SiteContainer0::<>p__Sitef
    L_05aa: ldfld !0 [System.Core]System.Runtime.CompilerServices.CallSite`1<class [mscorlib]System.Func`3<class [System.Core]System.Runtime.CompilerServices.CallSite, object, object>>::Target
    L_05af: ldsfld class [System.Core]System.Runtime.CompilerServices.CallSite`1<class [mscorlib]System.Func`3<class [System.Core]System.Runtime.CompilerServices.CallSite, object, object>> ExpandoObjectTesting.Program/<Main>o__SiteContainer0::<>p__Sitef
    L_05b4: ldloc.0 
    L_05b5: callvirt instance !2 [mscorlib]System.Func`3<class [System.Core]System.Runtime.CompilerServices.CallSite, object, object>::Invoke(!0, !1)
    L_05ba: callvirt instance !4 [mscorlib]System.Func`5<class [System.Core]System.Runtime.CompilerServices.CallSite, object, object, object, object>::Invoke(!0, !1, !2, !3)
    L_05bf: callvirt instance void [mscorlib]System.Action`4<class [System.Core]System.Runtime.CompilerServices.CallSite, class [mscorlib]System.Type, string, object>::Invoke(!0, !1, !2, !3)
    L_05c4: nop 
    L_05c5: ldsfld class [System.Core]System.Runtime.CompilerServices.CallSite`1<class [mscorlib]System.Action`3<class [System.Core]System.Runtime.CompilerServices.CallSite, object, object>> ExpandoObjectTesting.Program/<Main>o__SiteContainer0::<>p__Site10
    L_05ca: brtrue.s L_060a
    L_05cc: ldc.i4.0 
    L_05cd: ldstr "SayHello"
    L_05d2: ldtoken ExpandoObjectTesting.Program
    L_05d7: call class [mscorlib]System.Type [mscorlib]System.Type::GetTypeFromHandle(valuetype [mscorlib]System.RuntimeTypeHandle)
    L_05dc: ldnull 
    L_05dd: ldc.i4.2 
    L_05de: newarr [Microsoft.CSharp]Microsoft.CSharp.RuntimeBinder.CSharpArgumentInfo
    L_05e3: stloc.1 
    L_05e4: ldloc.1 
    L_05e5: ldc.i4.0 
    L_05e6: ldc.i4.0 
    L_05e7: ldnull 
    L_05e8: newobj instance void [Microsoft.CSharp]Microsoft.CSharp.RuntimeBinder.CSharpArgumentInfo::.ctor(valuetype [Microsoft.CSharp]Microsoft.CSharp.RuntimeBinder.CSharpArgumentInfoFlags, string)
    L_05ed: stelem.ref 
    L_05ee: ldloc.1 
    L_05ef: ldc.i4.1 
    L_05f0: ldc.i4.0 
    L_05f1: ldnull 
    L_05f2: newobj instance void [Microsoft.CSharp]Microsoft.CSharp.RuntimeBinder.CSharpArgumentInfo::.ctor(valuetype [Microsoft.CSharp]Microsoft.CSharp.RuntimeBinder.CSharpArgumentInfoFlags, string)
    L_05f7: stelem.ref 
    L_05f8: ldloc.1 
    L_05f9: newobj instance void [Microsoft.CSharp]Microsoft.CSharp.RuntimeBinder.CSharpInvokeMemberBinder::.ctor(valuetype [Microsoft.CSharp]Microsoft.CSharp.RuntimeBinder.CSharpCallFlags, string, class [mscorlib]System.Type, class [mscorlib]System.Collections.Generic.IEnumerable`1<class [mscorlib]System.Type>, class [mscorlib]System.Collections.Generic.IEnumerable`1<class [Microsoft.CSharp]Microsoft.CSharp.RuntimeBinder.CSharpArgumentInfo>)
    L_05fe: call class [System.Core]System.Runtime.CompilerServices.CallSite`1<!0> [System.Core]System.Runtime.CompilerServices.CallSite`1<class [mscorlib]System.Action`3<class [System.Core]System.Runtime.CompilerServices.CallSite, object, object>>::Create(class [System.Core]System.Runtime.CompilerServices.CallSiteBinder)
    L_0603: stsfld class [System.Core]System.Runtime.CompilerServices.CallSite`1<class [mscorlib]System.Action`3<class [System.Core]System.Runtime.CompilerServices.CallSite, object, object>> ExpandoObjectTesting.Program/<Main>o__SiteContainer0::<>p__Site10
    L_0608: br.s L_060a
    L_060a: ldsfld class [System.Core]System.Runtime.CompilerServices.CallSite`1<class [mscorlib]System.Action`3<class [System.Core]System.Runtime.CompilerServices.CallSite, object, object>> ExpandoObjectTesting.Program/<Main>o__SiteContainer0::<>p__Site10
    L_060f: ldfld !0 [System.Core]System.Runtime.CompilerServices.CallSite`1<class [mscorlib]System.Action`3<class [System.Core]System.Runtime.CompilerServices.CallSite, object, object>>::Target
    L_0614: ldsfld class [System.Core]System.Runtime.CompilerServices.CallSite`1<class [mscorlib]System.Action`3<class [System.Core]System.Runtime.CompilerServices.CallSite, object, object>> ExpandoObjectTesting.Program/<Main>o__SiteContainer0::<>p__Site10
    L_0619: ldloc.0 
    L_061a: ldsfld class [System.Core]System.Runtime.CompilerServices.CallSite`1<class [mscorlib]System.Func`3<class [System.Core]System.Runtime.CompilerServices.CallSite, object, object>> ExpandoObjectTesting.Program/<Main>o__SiteContainer0::<>p__Site11
    L_061f: brtrue.s L_0653
    L_0621: ldstr "Name"
    L_0626: ldtoken ExpandoObjectTesting.Program
    L_062b: call class [mscorlib]System.Type [mscorlib]System.Type::GetTypeFromHandle(valuetype [mscorlib]System.RuntimeTypeHandle)
    L_0630: ldc.i4.1 
    L_0631: newarr [Microsoft.CSharp]Microsoft.CSharp.RuntimeBinder.CSharpArgumentInfo
    L_0636: stloc.1 
    L_0637: ldloc.1 
    L_0638: ldc.i4.0 
    L_0639: ldc.i4.0 
    L_063a: ldnull 
    L_063b: newobj instance void [Microsoft.CSharp]Microsoft.CSharp.RuntimeBinder.CSharpArgumentInfo::.ctor(valuetype [Microsoft.CSharp]Microsoft.CSharp.RuntimeBinder.CSharpArgumentInfoFlags, string)
    L_0640: stelem.ref 
    L_0641: ldloc.1 
    L_0642: newobj instance void [Microsoft.CSharp]Microsoft.CSharp.RuntimeBinder.CSharpGetMemberBinder::.ctor(string, class [mscorlib]System.Type, class [mscorlib]System.Collections.Generic.IEnumerable`1<class [Microsoft.CSharp]Microsoft.CSharp.RuntimeBinder.CSharpArgumentInfo>)
    L_0647: call class [System.Core]System.Runtime.CompilerServices.CallSite`1<!0> [System.Core]System.Runtime.CompilerServices.CallSite`1<class [mscorlib]System.Func`3<class [System.Core]System.Runtime.CompilerServices.CallSite, object, object>>::Create(class [System.Core]System.Runtime.CompilerServices.CallSiteBinder)
    L_064c: stsfld class [System.Core]System.Runtime.CompilerServices.CallSite`1<class [mscorlib]System.Func`3<class [System.Core]System.Runtime.CompilerServices.CallSite, object, object>> ExpandoObjectTesting.Program/<Main>o__SiteContainer0::<>p__Site11
    L_0651: br.s L_0653
    L_0653: ldsfld class [System.Core]System.Runtime.CompilerServices.CallSite`1<class [mscorlib]System.Func`3<class [System.Core]System.Runtime.CompilerServices.CallSite, object, object>> ExpandoObjectTesting.Program/<Main>o__SiteContainer0::<>p__Site11
    L_0658: ldfld !0 [System.Core]System.Runtime.CompilerServices.CallSite`1<class [mscorlib]System.Func`3<class [System.Core]System.Runtime.CompilerServices.CallSite, object, object>>::Target
    L_065d: ldsfld class [System.Core]System.Runtime.CompilerServices.CallSite`1<class [mscorlib]System.Func`3<class [System.Core]System.Runtime.CompilerServices.CallSite, object, object>> ExpandoObjectTesting.Program/<Main>o__SiteContainer0::<>p__Site11
    L_0662: ldloc.0 
    L_0663: callvirt instance !2 [mscorlib]System.Func`3<class [System.Core]System.Runtime.CompilerServices.CallSite, object, object>::Invoke(!0, !1)
    L_0668: callvirt instance void [mscorlib]System.Action`3<class [System.Core]System.Runtime.CompilerServices.CallSite, object, object>::Invoke(!0, !1, !2)
    L_066d: nop 
    L_066e: call string [mscorlib]System.Console::ReadLine()
    L_0673: pop 
    L_0674: ret 
}
 

För att göra en lång historia kort... Det som sker är att det först skapas upp en instans av ExpandoObject, vilket ger ett object. Sedan används ett antal CallSites för att skapa upp en dynamisk call site som har hand om alla dynamiska handlingar som sker mot objektet.

När objektet binds så returneras ett expression tree med data för objektet, vilket sedan används för att arbeta med de metoder och den data som vi tidigare har skapat.

Då objekten skapas upp under runtime så kan vi även använda dem runt om i applikationen, vilket gör att vi kan göra t.ex. så här:

static dynamic GetExpendo()
{
    dynamic magic = new ExpandoObject();
 
    magic.IntX = 10;
    magic.IntY = 20;
    magic.Name = "Nisse";
    magic.SayHello = new Action<string>(x => Console.WriteLine("Hello, " + x + "!"));
    magic.Multiply = new Func<int, int, int>((x, y) => x * y);
 
    return magic;
}

Vi kan sedan skapa upp objektet genom:

dynamic magic = GetExpendo();

Det här fungerar lika bra som innan. Med andra ord så behandlas dynamiska ExpandoObject-instanser på samma sätt som vanliga statiska instanser.

No Comments