Trouble with Action<T1, T2> and passing multiple parameters

Posted by dotnetdev on Stack Overflow See other posts from Stack Overflow or by dotnetdev
Published on 2010-03-27T19:42:06Z Indexed on 2010/03/27 19:43 UTC
Read the original article Hit count: 228

Filed under:
|

Hi,

I have this code:

        s(x => x.Open());

s is a method which calls one parameter, which is perfectly fine, like so:

 public void s(Action<p1> action) {}

Ignoring the naming conventions, if I make the method like the below:

 public void s(Action<p1, p2> action) {}

How do I pass in more than one parameter? Out of interest, is there any way to use the params keyword with Action<>?

Also, I am using C# 4.0 so I would be interested to see how it can help me in an way.

Thanks

© Stack Overflow or respective owner

Related posts about c#

Related posts about c#4.0