Skip to content

mehrandvd/EasyAsync

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

19 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

EasyAsync

Build and Deploy Build and Deploy NuGet version (EasyAsync) NuGet downloads

A library to make async even easier!

Await Tuple

A tuple of tasks can be awaited and returns a tuple of results:

var t1 = CountAsync();
var t2 = GetMessageAsync();

// You can await tuples directly!
var (count, message) = await (t1, t2);

Await Enumerable

A tuple of tasks can be awaited and returns a tuple of results:

var tasks = new List<Task>();
foreach (var item in items)
{
  var task = DoAsync(item);
  tasks.Add(task);
}

// You can await enumerables directly!
var results = await tasks;

Forget Task

If you don't want to await on an async method, you can forget about it!

DoAsync().Forget();

instead of

_ = DoAsync();

Using Forget() is better because you can still have exception handling by passing onException to Forget:

StartAsync().Forget(onException: (exception) =>
                                 {
                                   // Handle the exception here...
                                 });

About

A library to make async even easier!

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages