Assign lambda to action <T>

It is known that you can assign a lambda that does not return a value to an object Action<T>. What about lambdas that theoretically return value? Like this:

Action<double> result = (x => x + 1);

Will the result be ignored?

Thank!

+3
source share
1 answer

You're using Func

Func<double, double> result = (x => x + 1);

If you write like this, the result can be ignored. Although this example is not very useful

Action<double> result = x => { x + 1; };
+9
source

All Articles