Метод | Описание | |
---|---|---|
MainForm ( ) : System |
Метод | Описание | |
---|---|---|
Dispose ( bool disposing ) : void |
Clean up any resources being used.
|
Метод | Описание | |
---|---|---|
CalculateRandomNumber ( ) : int |
Our really complicated, long running method
|
|
DoWorkWithAsync ( ) : Task |
Example of using async/await to add threading (non-blocking) to our app. Can you see how these are basically doing the same thing?
|
|
DoWorkWithManualContinuations ( ) : IEnumerable |
Example of using continuations (with coroutines) to add threading (non-blocking) to our app. Still using yield return, but our caller doesn't just enumerate the results because we don't want to block the UI. However, we're not having to use callbacks here. Why not? See AsyncResult code + the calling code. This ideas was popularized in .NET by the Caliburn library (which Deployer uses).
|
|
ExecuteContinuation ( IEnumerator |
Recursively call continuations... it doesn't care about threads or not
|
|
GetRandomNumbers ( int numberOfRandomsToReturn ) : IEnumerable |
Example of yield return here... C#'s implementation of coroutines Just syntactic sugar for returning an enumerable... except that it "yields" control to the calling method before going to the next option. And it is up to the caller to ask for the next result. (note the order of writelines) This is lazy evaluation works with LINQ (IQueryable)
|
|
GetRandomNumbersAsync ( int numberOfRandomsToReturn ) : Task |
Example of using async/await to add threading (non-blocking) to our app. Can you see how these are basically doing the same thing?
|
|
GetRandomNumbersContinuation ( int numberOfRandomsToReturn ) : IEnumerable |
Example of using continuations (with coroutines) to add threading (non-blocking) to our app. Still using yield return, but our caller doesn't just enumerate the results because we don't want to block the UI. However, we're not having to use callbacks here. Why not? See AsyncResult code + the calling code. This ideas was popularized in .NET by the Caliburn library (which Deployer uses).
|
|
InitializeComponent ( ) : void |
Required method for Designer support - do not modify the contents of this method with the code editor.
|
|
btnDoWorkAsync_Click ( object sender, |
C# does this for us natively now. Awesome.
|
|
btnDoWorkContinuation_Click ( object sender, |
This call will NOT block the UI thread.
|
|
btnDoWorkNormal_Click ( object sender, |
This call will block the UI thread... it also shows off the C# yield statement
|
|
btnNonBlockedUIManual_Click ( object sender, |
protected Dispose ( bool disposing ) : void | ||
disposing | bool | true if managed resources should be disposed; otherwise, false. |
Результат | void |