StephenCleary / AsyncEx

A helper library for async/await.
MIT License
3.49k stars 358 forks source link

Add TResult Run<TIn,TResult>(Func<TIn,Task<TResult>> action, TIn param) #240

Closed AceCoderYoda closed 3 years ago

AceCoderYoda commented 3 years ago

implement TResult Run<TIn,TResult>(Func<TIn,Task<TResult>> action, TIn param) so you can call AsyncContext.Run(Task, param)

i.e Task<Image> LoadImage(string url); so AsyncContext.Run(LoadImage, url)

StephenCleary commented 3 years ago

This is not necessary because C# has lambda expressions:

AsyncContext.Run(() => LoadImage(url));
AceCoderYoda commented 3 years ago

I am an idiot. Overthinking it...