How can I run a Task that return value and takes a parameter? I see that there is an overloaded method Task.Run<TResult>(Func<TResult>) but how I can pass a parameter there?
How can I run a Task that return value and takes a parameter? I
Share
Func<TResult>doesn’t take a parameter. Typically you would capture the parameter using a lambda expression instead. For example:Here
textis a captured variable… so even though you’re just creating aFunc<int>, it’s using the method parameter.