Last active
May 29, 2017 22:31
-
-
Save alexb5dh/45972dfba41bd43327792ae52f2d8cdd to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| using System.Threading.Tasks; | |
| public static class TaskExtensions | |
| { | |
| /// <summary> | |
| /// Synchronously awaits task throwing first exception if any instead of <see cref="System.AggregateException"/>. | |
| /// </summary> | |
| public static T Await<T>(this Task<T> task) => task.GetAwaiter().GetResult(); | |
| /// <summary> | |
| /// Synchronously awaits task throwing first exception if any instead of <see cref="System.AggregateException"/>. | |
| /// </summary> | |
| public static void Await(this Task task) => task.GetAwaiter().GetResult(); | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment