Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
Capturing values from a method call.
public override bool TryInvokeMember(
InvokeMemberBinder binder,
object[] args,
out object result)
{
_props[binder.Name] = GetValue(args) ?? string.Empty;
result = this;
return true;
}
private string GetValue(object[] args)
{
if (args.Length > 0)
{
var arg = args[0] as string;
if (arg != null)
{
return arg;
}
}
return null;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment