Example

 using System; using System.Threading; namespace Samples { public class MyIAsyncResultSample { internal class MyIAsyncResult: IAsyncResult { internal Object stateObject; internal bool complete = false; internal AutoResetEvent jobDone; internal MyIAsyncResult(Object stateObject) { this.stateObject = stateObject; this.jobDone = new AutoResetEvent(false); } public virtual Object AsyncState {get { return stateObject; }} public bool IsCompleted { get {return complete; }} public WaitHandle AsyncWaitHandle {get {return jobDone; }} public bool CompletedSynchronously {get {return false; }} } internal class RandomNumberProvider { private static Random r = new Random(); private void FillWithRandoms(object o) { MyIAsyncResult m = (MyIAsyncResult) ...

Get .NET Framework Standard Library Annotated Reference, Volume 1: Base Class Library and Extended Numerics Library now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.