Is it possible to call a method passing a lambda with variable number of parameters?
For example:
public void Go(Action x)
{
}
I need to call it passing parameters, such as:
Go(() => {});
Go((x, y) => {});
Go((x) => {});
Is it possible? How?
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
You could create overloads as in
Here is an article showing more examples of
Action<T>. Notice that it doesn’t return a value, from MSDN: