Reputation: 6152
I have the following lambda:
public object Execute(Action<IMessage<object>> method)
{
}
obj.Execute(x => someObject.RunSomething(new SomeMessage{a = "b"}));
SomeMessage
is implementing IMessage<T>
I would like inside Execute to get the params sent to RunSomething
...
I'm looking for something like method.Target as IMessage<object>
or method.Target as SomeMessage
How can that be achieved?
Thanks
Upvotes: 0
Views: 50
Reputation: 1909
Not sure what you want to achieve but isn't it more logic to have something like that ?
public object Execute(Action<IMessage<object>> method, IMessage<object> parameter)
{
method(parameter);
}
obj.Execute(someObject.RunSomething, new SomeMessage{a= "b"});
In that case you receive the parameter you will pass to the function. So you can do whatever you want with it.
Upvotes: 1