When I write in my code
Action(() => someCombobox.Text = "x" )
I get this error:
Delegate '
System.Action<object>
' does not take 0 arguments
Why?
This question is related to this one. I just want to understand why this error occurs.
You do not have to pass that as a constructor parameter:
Action a = () => someCombobox.Text = "x";
All you have to do is to declare an action and then use lambda expression to create it.
Alternatively you can pass the string to the action:
Action<string> a = (s) => someCombobox.Text = s;
a("your string here");
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With