I'am trying to emit the following code via Reflection:
this.Inputs = new DynamicCollection<IFunctionInput<Digital>>((string name) => new FunctionInput<Digital>(this, name));
The ctor of the DynamicCollection takes a func and looks like:
public DynamicCollection ( Func<string, T> createPin )
But when i look at the compiled IL code it gives me:
IL_0008: ldarg.0
IL_0009: ldarg.0
IL_000a: ldftn instance class [CM.Shared]CM.Shared.IFunctionInput`1<valuetype [CM.Shared]CM.Shared.Digital> CM.Server.LogicalAndFunctionServer::'<.ctor>b__0_0'(string)
IL_0010: newobj instance void class [mscorlib]System.Func`2<string, class [CM.Shared]CM.Shared.IFunctionInput`1<valuetype [CM.Shared]CM.Shared.Digital>>::.ctor(object, native int)
IL_0015: newobj instance void class CM.Server.DynamicCollection`1<class [CM.Shared]CM.Shared.IFunctionInput`1<valuetype [CM.Shared]CM.Shared.Digital>>::.ctor(class [mscorlib]System.Func`2<string, !0>)
IL_001a: stfld class [CM.Shared]CM.Shared.IDynamicCollection`1<class [CM.Shared]CM.Shared.IFunctionInput`1<valuetype [CM.Shared]CM.Shared.Digital>> CM.Server.LogicalAndFunctionServer::'<Inputs>k__BackingField'
IL_001f: ldarg.0
But where in this IL can i find the instanciation of the FunctionInput-class. I can only see some IFunctionInput-types which is the interface implemented by FunctionInput but how does this code know the real type to instanciate? Does anyone has an idea?
Aucun commentaire:
Enregistrer un commentaire