Skip to content

Instantly share code, notes, and snippets.

@therealjohn
therealjohn / AsyncHelper.cs
Created December 15, 2016 16:46 — forked from rid00z/AsyncHelper.cs
This code can be used to task a async task and run it without the async part.
public static class AsyncHelper
{
private static readonly TaskFactory _myTaskFactory = new
TaskFactory(CancellationToken.None,
TaskCreationOptions.None,
TaskContinuationOptions.None,
TaskScheduler.Default);
public static TResult RunSync<TResult>(Func<Task<TResult>> func)
{
class DataTaskDelegate : NSUrlSessionDataDelegate
{
NSUrlSessionHandler This { get; set; }
public DataTaskDelegate(NSUrlSessionHandler that)
{
this.This = that;
}
public override void DidReceiveChallenge(NSUrlSession session, NSUrlSessionTask task, NSUrlAuthenticationChallenge challenge, Action<NSUrlSessionAuthChallengeDisposition, NSUrlCredential> completionHandler)