Se ha denunciado esta presentación.
Utilizamos tu perfil de LinkedIn y tus datos de actividad para personalizar los anuncios y mostrarte publicidad más relevante. Puedes cambiar tus preferencias de publicidad en cualquier momento.
Author. Blogger. Speaker. C# MVP. Geek.
12:38
12:38
Load app
content
Sort
data
Process
records
Asynchronous task
UsingTasks
UsingAsyncandAwait
private async Task RunAsync()
{
var x = 10;
await Task.Delay(2000);
Debug.WriteLine(x);
}
private Task RunAsync()
{
<RunAsync>d__1 stateMachine = new <RunAsync>d__1 {
<>t__builder = AsyncTaskMethodBuilder.Create(...
if (num != 0)
{
this.<x>5__1 = 10;
awaiter = Task.Delay(2000).GetAwaiter();
if (!awaiter.IsCompleted)
{
. . . . . . . . . ...
private async void RunAsync()
{
var x = 10;
await Task.Delay(2000);
Debug.WriteLine(x);
}
private void RunAsync()
{
<RunAsync>d__1 stateMachine = new <RunAsync>d__1 {
<>t__builder = AsyncVoidMethodBuilder.Create(...
CloserlookatAsyncandAwait
AsyncandAwaitinASP.NET
$.post("ajax/test.html", function (data) {
$(".result").html(data);
})
Task.Run(() => { /* Lots of work to do! */ });
Task<string>.Run(() =>
{
/* Lots of work to do! */
return "Hello World!";
}...
Task.Run(() => { /* Lots of work to do! */ })
.ContinueWith((t) => { Debug.WriteLine("Done!"); });
await Task.Run(() => { ...
Task.Run(() => "Hello World!")
.ContinueWith((task) => Debug.WriteLine(task.Result));
var result = await Task.Run(() => "H...
private Task RunAsync()
{
<RunAsync>d__1 stateMachine = new <RunAsync>d__1 {
<>t__builder = AsyncTaskMethodBuilder.Create(...
Task.Run(() => { /* Lots of work to do! */ })
.ContinueWith((t) => { Debug.WriteLine("Done!"); });
await Task.Run(() => { ...
if (num != 0)
{
this.<x>5__1 = 10;
awaiter = Task.Delay(2000).GetAwaiter();
if (!awaiter.IsCompleted)
{
. . . . . . . . . ...
Task.Delay(1).ContinueWith((t) =>
{
Dispatcher.Invoke(() =>
{
});
}).Wait();
RunAsync().Wait();
Author. Blogger. Speaker. C# MVP. Geek.
Asynchronous programming
Asynchronous programming
Asynchronous programming
Asynchronous programming
Asynchronous programming
Asynchronous programming
Asynchronous programming
Asynchronous programming
Asynchronous programming
Asynchronous programming
Asynchronous programming
Asynchronous programming
Asynchronous programming
Asynchronous programming
Asynchronous programming
Asynchronous programming
Asynchronous programming
Asynchronous programming
Asynchronous programming
Asynchronous programming
Asynchronous programming
Asynchronous programming
Asynchronous programming
Asynchronous programming
Asynchronous programming
Asynchronous programming
Asynchronous programming
Asynchronous programming
Asynchronous programming
Asynchronous programming
Asynchronous programming
Asynchronous programming
Asynchronous programming
Asynchronous programming
Asynchronous programming
Asynchronous programming
Asynchronous programming
Asynchronous programming
Próxima SlideShare
Cargando en…5
×

Asynchronous programming

40.281 visualizaciones

Publicado el

Slides from my LIDNUG presentation on Asynchronous Programming.

Publicado en: Tecnología
  • Follow the link, new dating source: ❤❤❤ http://bit.ly/39sFWPG ❤❤❤
       Responder 
    ¿Estás seguro?    No
    Tu mensaje aparecerá aquí
  • Dating direct: ❤❤❤ http://bit.ly/39sFWPG ❤❤❤
       Responder 
    ¿Estás seguro?    No
    Tu mensaje aparecerá aquí
  • DOWNLOAD FULL BOOKS INTO AVAILABLE FORMAT ......................................................................................................................... ......................................................................................................................... 1.DOWNLOAD FULL PDF EBOOK here { https://tinyurl.com/y8nn3gmc } ......................................................................................................................... 1.DOWNLOAD FULL EPUB Ebook here { https://tinyurl.com/y8nn3gmc } ......................................................................................................................... 1.DOWNLOAD FULL doc Ebook here { https://tinyurl.com/y8nn3gmc } ......................................................................................................................... 1.DOWNLOAD FULL PDF EBOOK here { https://tinyurl.com/y8nn3gmc } ......................................................................................................................... 1.DOWNLOAD FULL EPUB Ebook here { https://tinyurl.com/y8nn3gmc } ......................................................................................................................... 1.DOWNLOAD FULL doc Ebook here { https://tinyurl.com/y8nn3gmc } ......................................................................................................................... ......................................................................................................................... ......................................................................................................................... .............. Browse by Genre Available eBooks ......................................................................................................................... Art, Biography, Business, Chick Lit, Children's, Christian, Classics, Comics, Contemporary, Cookbooks, Crime, Ebooks, Fantasy, Fiction, Graphic Novels, Historical Fiction, History, Horror, Humor And Comedy, Manga, Memoir, Music, Mystery, Non Fiction, Paranormal, Philosophy, Poetry, Psychology, Religion, Romance, Science, Science Fiction, Self Help, Suspense, Spirituality, Sports, Thriller, Travel, Young Adult,
       Responder 
    ¿Estás seguro?    No
    Tu mensaje aparecerá aquí

Asynchronous programming

  1. 1. Author. Blogger. Speaker. C# MVP. Geek.
  2. 2. 12:38
  3. 3. 12:38 Load app content Sort data Process records Asynchronous task
  4. 4. UsingTasks
  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. if (num != 0) { this.<x>5__1 = 10; awaiter = Task.Delay(2000).GetAwaiter(); if (!awaiter.IsCompleted) { . . . . . . . . . . . . return; } } else { . . . . . } awaiter.GetResult(); awaiter = new TaskAwaiter(); Debug.WriteLine(this.<x>5__1);
  9. 9. private async void RunAsync() { var x = 10; await Task.Delay(2000); Debug.WriteLine(x); }
  10. 10. private void RunAsync() { <RunAsync>d__1 stateMachine = new <RunAsync>d__1 { <>t__builder = AsyncVoidMethodBuilder.Create(), <>1__state = -1 }; stateMachine.<>t__builder.Start<<RunAsync>d__1>(ref stateMachine); }
  11. 11. CloserlookatAsyncandAwait
  12. 12. AsyncandAwaitinASP.NET
  13. 13. $.post("ajax/test.html", function (data) { $(".result").html(data); })
  14. 14. Task.Run(() => { /* Lots of work to do! */ }); Task<string>.Run(() => { /* Lots of work to do! */ return "Hello World!"; });
  15. 15. Task.Run(() => { /* Lots of work to do! */ }) .ContinueWith((t) => { Debug.WriteLine("Done!"); }); await Task.Run(() => { /* Lots of work to do! */ }); Debug.WriteLine("Done!");
  16. 16. Task.Run(() => "Hello World!") .ContinueWith((task) => Debug.WriteLine(task.Result)); var result = await Task.Run(() => "Hello World!"); Debug.WriteLine(result);
  17. 17. 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; }
  18. 18. Task.Run(() => { /* Lots of work to do! */ }) .ContinueWith((t) => { Debug.WriteLine("Done!"); }); await Task.Run(() => { /* Lots of work to do! */ }); Debug.WriteLine("Done!");
  19. 19. if (num != 0) { this.<x>5__1 = 10; awaiter = Task.Delay(2000).GetAwaiter(); if (!awaiter.IsCompleted) { . . . . . . . . . . . . return; } } else { . . . . . } awaiter.GetResult(); awaiter = new TaskAwaiter(); Debug.WriteLine(this.<x>5__1);
  20. 20. Task.Delay(1).ContinueWith((t) => { Dispatcher.Invoke(() => { }); }).Wait(); RunAsync().Wait();
  21. 21. Author. Blogger. Speaker. C# MVP. Geek.

×