The documentation for this method says:
Task Method. Yield () - adapted from English
Creates a startling task that returns asynchronously to the current context when awaited .
I read the source code for it and got lost even more! / p>
public static YieldAwaitable Yield()
{
return new YieldAwaitable();
}
The class YieldAwaitable
is described in this way: it provides a startable context to switch to a target environment ( provides an expected context for switching to a target environment ) .
I do not understand the actual use of it.
What does this function actually do? In what contexts would this method bring advantages and why?
This question refers to the Task.Yield
method and not to the yield
keyword.
I did some translations on this question that may not be very good. Editions are welcome. (1) I do not know if eagerly would replace 100% the word awaitable , so I added the spelling.