Quantcast
Channel: Active questions tagged blazor - Stack Overflow
Viewing all articles
Browse latest Browse all 4839

Why use await Task.Delay(1) in Blazor wasm?

$
0
0

Many SO answers use await Task.Delay(1) to solve various async rendering issues in Blazor (wasm). I've even found a number of places in my own code where doing that "makes it work".

However it's always stated as matter of fact, without a thorough explanation, and I can't find this technique in the docs either.

Some questions:

  • Why use await Task.Delay(1) - when would I use this technique, what is the use case?
  • The docs do not discuss this (that I could find); is it because it's a hack, or is it a legitimate way to deal with the use case?
  • Any difference between Task.Delay(1) and Task.Yield()?

Viewing all articles
Browse latest Browse all 4839

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>