Skip to content

Instantly share code, notes, and snippets.

@kalambet
Created April 11, 2015 18:32
Show Gist options
  • Save kalambet/92647c46b64dd2ffaf5f to your computer and use it in GitHub Desktop.
Save kalambet/92647c46b64dd2ffaf5f to your computer and use it in GitHub Desktop.
DTO in C# 4 Part6
Assembly assembly = Assembly.LoadFrom(@"./delme.ext.dll");
object instance = assembly.CreateInstance("delme.ext.CDelmeExt");
CSharpCallPayload payload =
new CSharpCallPayload(
RuntimeBinder.GetInstance(),
false,
false,
"WhoAreYou",
typeof(object),
null);
var callSite = CallSite<func<callsite, object,="" bool,="" object="">>.Create(payload);
var func = callSite.Target;
object str = func.Invoke(callSite, instance, true);
if (str is string)
MessageBox.Show((string)str);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment