fab
fab

Reputation: 21

ComplexTypes and dynamicwrapper

DynamicWrapper lets associate interface to object in this way

IDoSomething actor = objectWithoutInterface.As<IDoSomething>();

How can I extend this library so that I can write something like

actor.Get(MyTypeCopy myComplexObject);

in order to call

objectWithoutInterface.Get(MyType myComplexType);

where MyTypeCopy is a copy of MyType in another namespace?

One soulution would be to add

Get(dynamic myComplexObject);

to the interface, and apply the cast (Serialization/Deserialization) before invoking the method.

Is there a way to add a DynamicMethod to apply the cast inside the DynamicWrapper library?

Upvotes: 0

Views: 167

Answers (1)

fab
fab

Reputation: 21

just add

ilGenerator.Emit(OpCodes.Call, convertType);

after pushing each parameter

Upvotes: 0

Related Questions