Skip to content

Instantly share code, notes, and snippets.

@takeshik
Created November 21, 2011 10:51
Show Gist options
  • Save takeshik/1382296 to your computer and use it in GitHub Desktop.
Save takeshik/1382296 to your computer and use it in GitHub Desktop.
typeof(Action<>).MakeGenericType(c.Event.EventHandlerType).Let(t => Call(
typeof(Observable),
"FromEventPattern",
new []
{
c.Event.EventHandlerType,
c.Event.EventHandlerType.GetMethod("Invoke").GetParameters()[1].ParameterType,
},
Convert(Call(
typeof(Delegate),
"CreateDelegate",
Type.EmptyTypes,
Constant(t),
this._left is TypeCandidateExpression
? Default(typeof(Object))
: this._left,
Constant(c.Event.GetAddMethod())
), t),
Convert(Call(
typeof(Delegate),
"CreateDelegate",
Type.EmptyTypes,
Constant(t),
this._left is TypeCandidateExpression
? Default(typeof(Object))
: this._left,
Constant(c.Event.GetRemoveMethod())
), t)
));
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment