mirror of
https://github.com/wabbajack-tools/wabbajack.git
synced 2024-08-30 18:42:17 +00:00
25 lines
536 B
C#
25 lines
536 B
C#
|
using System;
|
|||
|
using System.Collections.Generic;
|
|||
|
using System.Linq;
|
|||
|
using System.Text;
|
|||
|
using System.Threading.Tasks;
|
|||
|
|
|||
|
namespace Wabbajack
|
|||
|
{
|
|||
|
public static class TaskExt
|
|||
|
{
|
|||
|
public static async void FireAndForget(this Task task, Action<Exception> onException = null)
|
|||
|
{
|
|||
|
try
|
|||
|
{
|
|||
|
await task.ConfigureAwait(false);
|
|||
|
}
|
|||
|
catch (Exception ex)
|
|||
|
when (onException != null)
|
|||
|
{
|
|||
|
onException(ex);
|
|||
|
}
|
|||
|
}
|
|||
|
}
|
|||
|
}
|