Is it possible to pass a condition as parameter as you do with actions?
Here’s an example.
public void Test(Action action, Condition condition);
…
Test( () => Environment.Exit(0), () => variable == variable2 );
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.
Try passing the second argument as type
Func<Boolean>. The code should work as you have it in the second part of your question:EDIT: Note that what you would be doing in your usage example is creating a Closure containing the captured variables variable and variable2. You should understand the implications of closures before using them in this way.