Successfully reported this slideshow.
We use your LinkedIn profile and activity data to personalize ads and to show you more relevant ads. You can change your ad preferences anytime.

Asynchronous programming from Xamarin Hakcday in Melbourne

704 views

Published on

These are the slides from my Async talk at the Xamarin Hackday in Melbourne

Published in: Technology
  • Login to see the comments

Asynchronous programming from Xamarin Hakcday in Melbourne

  1. 1. Author. Blogger. Speaker. C# MVP. Xamarin MVP. Geek. Senior Software Engineer @Invoice2go
  2. 2. 12:38
  3. 3. var task = Task.Run(() => { Thread.Sleep(2000); return "Hello World!"; }); task.ContinueWith((completedTask) => { Dispatcher.Invoke(() => MyButton.Content = completedTask.Result); });
  4. 4. Task.Delay(1).ContinueWith((t) => { Dispatcher.Invoke(() => { }); }).Wait();
  5. 5. UsingAsyncandAwait
  6. 6. private async Task RunAsync() { var x = 10; await Task.Delay(2000); Debug.WriteLine(x); }
  7. 7. private Task RunAsync() { <RunAsync>d__1 stateMachine = new <RunAsync>d__1 { <>t__builder = AsyncTaskMethodBuilder.Create(), <>1__state = -1 }; stateMachine.<>t__builder.Start<<RunAsync>d__1>(ref stateMachine); return stateMachine.<>t__builder.Task; }
  8. 8. Deadlockallthethings!
  9. 9. Author. Blogger. Speaker. C# MVP. Geek.

×