I have a method which accepts an Action
delegate and executes the given method as shown here:
public void ExpMethod(Action inputDel)
{
inpuDel();
}
I can call above given method like this:
ExpMethod(() => {/*do something that matters*/});
Everything works fine. So far so good. Now I want to have a method which takes a generic Action
delegate as an input parameter - like this:
public void ExpGenMethod(Action<string,int> inputDel)
{
// I don't know how to call the supplied delegate as it requires parameters
}
Also, I am trying to call this ExpGenMethod
in this way:
ExpGenMethod(("Hi",1) => {/*do something that makes sense*/});
But it shows syntax errors. Please let me know how to use generic action delegate in this case?
"Hi"
and1
wouldn't be on the left of the=>
. – Flexuous