markus / FileDownloader / TaskExtensions.cs @ master
이력 | 보기 | 이력해설 | 다운로드 (499 Bytes)
1 |
using System; |
---|---|
2 |
using System.Collections.Generic; |
3 |
using System.Linq; |
4 |
using System.Text; |
5 |
using System.Threading.Tasks; |
6 |
|
7 |
namespace PageManager |
8 |
{ |
9 |
public static class TaskExtensions |
10 |
{ |
11 |
public static async void RunAndForget( |
12 |
this Task task, Action<Exception> onException = null) |
13 |
{ |
14 |
try |
15 |
{ |
16 |
await task; |
17 |
} |
18 |
catch (Exception ex) |
19 |
{ |
20 |
onException?.Invoke(ex); |
21 |
} |
22 |
} |
23 |
} |
24 |
} |