#if NETFRAMEWORK
using System.Threading.Tasks;
#endif
namespace ReC.Client
{
///
/// Provides synchronous wrappers for Task-based operations.
///
public static class TaskSyncExtensions
{
///
/// Blocks until the task completes and propagates any exception.
///
/// The task to wait for.
public static void Sync(this Task task) => task.ConfigureAwait(false).GetAwaiter().GetResult();
///
/// Blocks until the task completes and returns its result, propagating any exception.
///
/// The type of the task result.
/// The task to wait for.
/// The result of the completed task.
public static TResult Sync(this Task task) => task.ConfigureAwait(false).GetAwaiter().GetResult();
}
}