mehrandvd / EasyAsync

A library to make async even easier!

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

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!

License:MIT License


Languages

Language:C# 100.0%