Nito.AsyncEx.Tasks An awaitable wrapper around a task whose result is disposable. The wrapper is not disposable, so this prevents usage errors like "using (MyAsync())" when the appropriate usage should be "using (await MyAsync())". The type of the result of the underlying task. The underlying task. Initializes a new awaitable wrapper around the specified task. The underlying task to wrap. This may not be null. Returns the underlying task. Implicit conversion to the underlying task. The awaitable wrapper. Infrastructure. Returns the task awaiter for the underlying task. Infrastructure. Returns a configured task awaiter for the underlying task. Whether to attempt to marshal the continuation back to the captured context. Holds the task for a cancellation token, as well as the token registration. The registration is disposed when this instance is disposed. The cancellation token registration, if any. This is null if the registration was not necessary. Creates a task for the specified cancellation token, registering with the token if necessary. The cancellation token to observe. Gets the task for the source cancellation token. Disposes the cancellation token registration, if any. Note that this may cause to never complete. Creation methods for tasks wrapping the Asynchronous Programming Model (APM), and APM wrapper methods around tasks. Wraps a into the Begin method of an APM pattern. The task to wrap. The callback method passed into the Begin method of the APM pattern. The state passed into the Begin method of the APM pattern. The asynchronous operation, to be returned by the Begin method of the APM pattern. Wraps a into the End method of an APM pattern. The asynchronous operation returned by the matching Begin method of this APM pattern. The result of the asynchronous operation, to be returned by the End method of the APM pattern. Wraps a into the Begin method of an APM pattern. The task to wrap. May not be null. The callback method passed into the Begin method of the APM pattern. The state passed into the Begin method of the APM pattern. The asynchronous operation, to be returned by the Begin method of the APM pattern. Wraps a into the End method of an APM pattern. The asynchronous operation returned by the matching Begin method of this APM pattern. The result of the asynchronous operation, to be returned by the End method of the APM pattern. Arguments passed to a .NET event that follows the standard sender, arguments event pattern. The type of the sender of the event. This is commonly . The type of the event arguments. This is commonly or a derived type. The sender of the event. The event arguments. Creation methods for tasks wrapping events. Returns a that completes when a specified event next fires. This overload is for events that are of any type. The type of the event delegate. A type containing all event arguments. A conversion delegate that takes an and converts it to a . This is generally of the form x => (...) => x(new TEventArguments(...)). A method that takes a and subscribes it to the event. A method that takes an and unsubscribes it from the event. This method is invoked in a captured context if is true. A cancellation token that can be used to cancel the task (and unsubscribe from the event handler). Whether to invoke on a captured context. Calling this method in a loop is often an anti-pattern, because the event is only subscribed to when this method is invoked, and is unsubscribed from when the task completes. From the time the task is completed until this method is called again, the event may fire and be "lost". If you find yourself needing a loop around this method, consider using Rx or TPL Dataflow instead. Returns a that completes when a specified event next fires. This overload is for events that are of any type. The type of the event delegate. A type containing all event arguments. A conversion delegate that takes an and converts it to a . This is generally of the form x => (...) => x(new TEventArguments(...)). A method that takes a and subscribes it to the event. A method that takes a and unsubscribes it from the event. This method is always invoked in a captured context. A cancellation token that can be used to cancel the task (and unsubscribe from the event handler). Calling this method in a loop is often an anti-pattern, because the event is only subscribed to when this method is invoked, and is unsubscribed from when the task completes. From the time the task is completed until this method is called again, the event may fire and be "lost". If you find yourself needing a loop around this method, consider using Rx or TPL Dataflow instead. Returns a that completes when a specified event next fires. This overload is for events that are of any type. The type of the event delegate. A type containing all event arguments. A conversion delegate that takes an and converts it to a . This is generally of the form x => (...) => x(new TEventArguments(...)). A method that takes a and subscribes it to the event. A method that takes a and unsubscribes it from the event. This method is always invoked in a captured context. Calling this method in a loop is often an anti-pattern, because the event is only subscribed to when this method is invoked, and is unsubscribed from when the task completes. From the time the task is completed until this method is called again, the event may fire and be "lost". If you find yourself needing a loop around this method, consider using Rx or TPL Dataflow instead. Returns a that completes when a specified event next fires. This overload is for events that are of type . A method that takes a and subscribes it to the event. A method that takes an and unsubscribes it from the event. This method is invoked in a captured context if is true. A cancellation token that can be used to cancel the task (and unsubscribe from the event handler). Whether to invoke on a captured context. Calling this method in a loop is often an anti-pattern, because the event is only subscribed to when this method is invoked, and is unsubscribed from when the task completes. From the time the task is completed until this method is called again, the event may fire and be "lost". If you find yourself needing a loop around this method, consider using Rx or TPL Dataflow instead. Returns a that completes when a specified event next fires. This overload is for events that are of type . A method that takes a and subscribes it to the event. A method that takes a and unsubscribes it from the event. This method is always invoked in a captured context. A cancellation token that can be used to cancel the task (and unsubscribe from the event handler). Calling this method in a loop is often an anti-pattern, because the event is only subscribed to when this method is invoked, and is unsubscribed from when the task completes. From the time the task is completed until this method is called again, the event may fire and be "lost". If you find yourself needing a loop around this method, consider using Rx or TPL Dataflow instead. Returns a that completes when a specified event next fires. This overload is for events that are of type . A method that takes a and subscribes it to the event. A method that takes a and unsubscribes it from the event. This method is always invoked in a captured context. Calling this method in a loop is often an anti-pattern, because the event is only subscribed to when this method is invoked, and is unsubscribed from when the task completes. From the time the task is completed until this method is called again, the event may fire and be "lost". If you find yourself needing a loop around this method, consider using Rx or TPL Dataflow instead. Returns a that completes when a specified event next fires. This overload is for events that are of type . The type of the "arguments" (the second event argument). A method that takes a and subscribes it to the event. A method that takes an and unsubscribes it from the event. This method is invoked in a captured context if is true. A cancellation token that can be used to cancel the task (and unsubscribe from the event handler). Whether to invoke on a captured context. Calling this method in a loop is often an anti-pattern, because the event is only subscribed to when this method is invoked, and is unsubscribed from when the task completes. From the time the task is completed until this method is called again, the event may fire and be "lost". If you find yourself needing a loop around this method, consider using Rx or TPL Dataflow instead. Returns a that completes when a specified event next fires. This overload is for events that are of type . The type of the "arguments" (the second event argument). A method that takes a and subscribes it to the event. A method that takes a and unsubscribes it from the event. This method is always invoked in a captured context. A cancellation token that can be used to cancel the task (and unsubscribe from the event handler). Calling this method in a loop is often an anti-pattern, because the event is only subscribed to when this method is invoked, and is unsubscribed from when the task completes. From the time the task is completed until this method is called again, the event may fire and be "lost". If you find yourself needing a loop around this method, consider using Rx or TPL Dataflow instead. Returns a that completes when a specified event next fires. This overload is for events that are of type . The type of the "arguments" (the second event argument). A method that takes a and subscribes it to the event. A method that takes a and unsubscribes it from the event. This method is always invoked in a captured context. Calling this method in a loop is often an anti-pattern, because the event is only subscribed to when this method is invoked, and is unsubscribed from when the task completes. From the time the task is completed until this method is called again, the event may fire and be "lost". If you find yourself needing a loop around this method, consider using Rx or TPL Dataflow instead. Returns a that completes when a specified event next fires. This overload is for events that follow the standard sender, eventArgs pattern but with a custom delegate type. The type of the event delegate. The type of the "arguments" (the second event argument). A conversion delegate that takes an and converts it to a . If the type parameters are specified explicitly, this should be x => x.Invoke. If the type parameters are inferred, this should be (EventHandler<TEventArgs> x) => new TDelegate(x) with appropriate substitutions for and . A method that takes a and subscribes it to the event. A method that takes an and unsubscribes it from the event. This method is invoked in a captured context if is true. A cancellation token that can be used to cancel the task (and unsubscribe from the event handler). Whether to invoke on a captured context. Calling this method in a loop is often an anti-pattern, because the event is only subscribed to when this method is invoked, and is unsubscribed from when the task completes. From the time the task is completed until this method is called again, the event may fire and be "lost". If you find yourself needing a loop around this method, consider using Rx or TPL Dataflow instead. Returns a that completes when a specified event next fires. This overload is for events that follow the standard sender, eventArgs pattern but with a custom delegate type. The type of the event delegate. The type of the "arguments" (the second event argument). A conversion delegate that takes an and converts it to a . If the type parameters are specified explicitly, this should be x => x.Invoke. If the type parameters are inferred, this should be (EventHandler<TEventArgs> x) => new TDelegate(x) with appropriate substitutions for and . A method that takes a and subscribes it to the event. A method that takes a and unsubscribes it from the event. This method is always invoked in a captured context. A cancellation token that can be used to cancel the task (and unsubscribe from the event handler). Calling this method in a loop is often an anti-pattern, because the event is only subscribed to when this method is invoked, and is unsubscribed from when the task completes. From the time the task is completed until this method is called again, the event may fire and be "lost". If you find yourself needing a loop around this method, consider using Rx or TPL Dataflow instead. Returns a that completes when a specified event next fires. This overload is for events that follow the standard sender, eventArgs pattern but with a custom delegate type. The type of the event delegate. The type of the "arguments" (the second event argument). A conversion delegate that takes an and converts it to a . If the type parameters are specified explicitly, this should be x => x.Invoke. If the type parameters are inferred, this should be (EventHandler<TEventArgs> x) => new TDelegate(x) with appropriate substitutions for and . A method that takes a and subscribes it to the event. A method that takes a and unsubscribes it from the event. This method is always invoked in a captured context. Calling this method in a loop is often an anti-pattern, because the event is only subscribed to when this method is invoked, and is unsubscribed from when the task completes. From the time the task is completed until this method is called again, the event may fire and be "lost". If you find yourself needing a loop around this method, consider using Rx or TPL Dataflow instead. Returns a that completes when a specified event next fires. This overload is for events that are of type . The type of the "sender" (the first event argument). The type of the "arguments" (the second event argument). A method that takes an and subscribes it to the event. A method that takes an and unsubscribes it from the event. This method is invoked in a captured context if is true. A cancellation token that can be used to cancel the task (and unsubscribe from the event handler). Whether to invoke on a captured context. Calling this method in a loop is often an anti-pattern, because the event is only subscribed to when this method is invoked, and is unsubscribed from when the task completes. From the time the task is completed until this method is called again, the event may fire and be "lost". If you find yourself needing a loop around this method, consider using Rx or TPL Dataflow instead. Returns a that completes when a specified event next fires. This overload is for events that are of type . The type of the "sender" (the first event argument). The type of the "arguments" (the second event argument). A method that takes an and subscribes it to the event. A method that takes an and unsubscribes it from the event. This method is always invoked in a captured context. A cancellation token that can be used to cancel the task (and unsubscribe from the event handler). Calling this method in a loop is often an anti-pattern, because the event is only subscribed to when this method is invoked, and is unsubscribed from when the task completes. From the time the task is completed until this method is called again, the event may fire and be "lost". If you find yourself needing a loop around this method, consider using Rx or TPL Dataflow instead. Returns a that completes when a specified event next fires. This overload is for events that are of type . The type of the "sender" (the first event argument). The type of the "arguments" (the second event argument). A method that takes an and subscribes it to the event. A method that takes an and unsubscribes it from the event. This method is always invoked in a captured context. Calling this method in a loop is often an anti-pattern, because the event is only subscribed to when this method is invoked, and is unsubscribed from when the task completes. From the time the task is completed until this method is called again, the event may fire and be "lost". If you find yourself needing a loop around this method, consider using Rx or TPL Dataflow instead. Returns a that completes when a specified event next fires. This overload is for events that are of type . The type of the argument passed to the event handler and used to complete the task. A method that takes an and subscribes it to the event. A method that takes an and unsubscribes it from the event. This method is invoked in a captured context if is true. A cancellation token that can be used to cancel the task (and unsubscribe from the event handler). Whether to invoke on a captured context. Calling this method in a loop is often an anti-pattern, because the event is only subscribed to when this method is invoked, and is unsubscribed from when the task completes. From the time the task is completed until this method is called again, the event may fire and be "lost". If you find yourself needing a loop around this method, consider using Rx or TPL Dataflow instead. Returns a that completes when a specified event next fires. This overload is for events that are of type . The type of the argument passed to the event handler and used to complete the task. A method that takes an and subscribes it to the event. A method that takes an and unsubscribes it from the event. This method is always invoked in a captured context. A cancellation token that can be used to cancel the task (and unsubscribe from the event handler). Calling this method in a loop is often an anti-pattern, because the event is only subscribed to when this method is invoked, and is unsubscribed from when the task completes. From the time the task is completed until this method is called again, the event may fire and be "lost". If you find yourself needing a loop around this method, consider using Rx or TPL Dataflow instead. Returns a that completes when a specified event next fires. This overload is for events that are of type . The type of the argument passed to the event handler and used to complete the task. A method that takes an and subscribes it to the event. A method that takes an and unsubscribes it from the event. This method is always invoked in a captured context. Calling this method in a loop is often an anti-pattern, because the event is only subscribed to when this method is invoked, and is unsubscribed from when the task completes. From the time the task is completed until this method is called again, the event may fire and be "lost". If you find yourself needing a loop around this method, consider using Rx or TPL Dataflow instead. Returns a that completes when a specified event next fires. This overload is for events that are of type . A method that takes an and subscribes it to the event. A method that takes an and unsubscribes it from the event. This method is invoked in a captured context if is true. A cancellation token that can be used to cancel the task (and unsubscribe from the event handler). Whether to invoke on a captured context. Calling this method in a loop is often an anti-pattern, because the event is only subscribed to when this method is invoked, and is unsubscribed from when the task completes. From the time the task is completed until this method is called again, the event may fire and be "lost". If you find yourself needing a loop around this method, consider using Rx or TPL Dataflow instead. Returns a that completes when a specified event next fires. This overload is for events that are of type . A method that takes an and subscribes it to the event. A method that takes an and unsubscribes it from the event. This method is always invoked in a captured context. A cancellation token that can be used to cancel the task (and unsubscribe from the event handler). Calling this method in a loop is often an anti-pattern, because the event is only subscribed to when this method is invoked, and is unsubscribed from when the task completes. From the time the task is completed until this method is called again, the event may fire and be "lost". If you find yourself needing a loop around this method, consider using Rx or TPL Dataflow instead. Returns a that completes when a specified event next fires. This overload is for events that are of type . A method that takes an and subscribes it to the event. A method that takes an and unsubscribes it from the event. This method is always invoked in a captured context. Calling this method in a loop is often an anti-pattern, because the event is only subscribed to when this method is invoked, and is unsubscribed from when the task completes. From the time the task is completed until this method is called again, the event may fire and be "lost". If you find yourself needing a loop around this method, consider using Rx or TPL Dataflow instead. Creates an structure. The type of the sender of the event. The event arguments. The sender of the event. The event arguments. Provides extension methods for . Asynchronously waits on the semaphore, and returns a disposable that releases the semaphore when disposed, thus treating this semaphore as a "multi-lock". The semaphore to lock. The cancellation token used to cancel the wait. Asynchronously waits on the semaphore, and returns a disposable that releases the semaphore when disposed, thus treating this semaphore as a "multi-lock". Synchronously waits on the semaphore, and returns a disposable that releases the semaphore when disposed, thus treating this semaphore as a "multi-lock". The semaphore to lock. The cancellation token used to cancel the wait. Synchronously waits on the semaphore, and returns a disposable that releases the semaphore when disposed, thus treating this semaphore as a "multi-lock". The semaphore to lock. Provides extension methods for . Synchronously executes a delegate on this synchronization context. The synchronization context. The delegate to execute. Synchronously executes a delegate on this synchronization context and returns its result. The type of the result. The synchronization context. The delegate to execute. Asynchronously executes a delegate on this synchronization context. The synchronization context. The delegate to execute. Asynchronously executes a delegate on this synchronization context and returns its result. The type of the result. The synchronization context. The delegate to execute. Asynchronously executes an asynchronous delegate on this synchronization context. The synchronization context. The delegate to execute. Asynchronously executes an asynchronous delegate on this synchronization context and returns its result. The type of the result. The synchronization context. The delegate to execute. Utility class for temporarily switching implementations. The previous . Initializes a new instance of the class, installing the new . The new . This can be null to remove an existing . Restores the old . Executes a synchronous delegate without the current . The current context is restored when this function returns. The delegate to execute. Executes a synchronous or asynchronous delegate without the current . The current context is restored when this function synchronously returns. The delegate to execute. Executes a synchronous delegate with the specified as "current". The previous current context is restored when this function returns. The context to treat as "current". May be null to indicate the thread pool context. The delegate to execute. Executes a synchronous or asynchronous delegate without the specified as "current". The previous current context is restored when this function synchronously returns. The context to treat as "current". May be null to indicate the thread pool context. The delegate to execute. Provides synchronous extension methods for tasks. Waits for the task to complete, unwrapping any exceptions. The task. May not be null. Waits for the task to complete, unwrapping any exceptions. The task. May not be null. A cancellation token to observe while waiting for the task to complete. The was cancelled before the completed, or the raised an . Waits for the task to complete, unwrapping any exceptions. The type of the result of the task. The task. May not be null. The result of the task. Waits for the task to complete, unwrapping any exceptions. The type of the result of the task. The task. May not be null. A cancellation token to observe while waiting for the task to complete. The result of the task. The was cancelled before the completed, or the raised an . Waits for the task to complete, but does not raise task exceptions. The task exception (if any) is unobserved. The task. May not be null. Waits for the task to complete, but does not raise task exceptions. The task exception (if any) is unobserved. The task. May not be null. A cancellation token to observe while waiting for the task to complete. The was cancelled before the completed. Provides extension methods for . Attempts to complete a , propagating the completion of . The type of the result of the target asynchronous operation. The type of the result of the source asynchronous operation. The task completion source. May not be null. The task. May not be null. true if this method completed the task completion source; false if it was already completed. Attempts to complete a , propagating the completion of but using the result value from if the task completed successfully. The type of the result of the target asynchronous operation. The task completion source. May not be null. The task. May not be null. A delegate that returns the result with which to complete the task completion source, if the task completed successfully. May not be null. true if this method completed the task completion source; false if it was already completed. Creates a new TCS for use with async code, and which forces its continuations to execute asynchronously. The type of the result of the TCS. Provides completed task constants. A task that has been completed with the value true. A task that has been completed with the value false. A task that has been completed with the value 0. A task that has been completed with the value -1. A that has been completed. A task that has been canceled. Provides completed task constants. The type of the task result. A task that has been completed with the default value of . A task that has been canceled. Provides extension methods for the and types. Asynchronously waits for the task to complete, or for the cancellation token to be canceled. The task to wait for. May not be null. The cancellation token that cancels the wait. Asynchronously waits for the task to complete, or for the cancellation token to be canceled. The type of the task result. The task to wait for. May not be null. The cancellation token that cancels the wait. Asynchronously waits for any of the source tasks to complete, or for the cancellation token to be canceled. The tasks to wait for. May not be null. The cancellation token that cancels the wait. Asynchronously waits for any of the source tasks to complete. The tasks to wait for. May not be null. Asynchronously waits for any of the source tasks to complete, or for the cancellation token to be canceled. The type of the task results. The tasks to wait for. May not be null. The cancellation token that cancels the wait. Asynchronously waits for any of the source tasks to complete. The type of the task results. The tasks to wait for. May not be null. Asynchronously waits for all of the source tasks to complete. The tasks to wait for. May not be null. Asynchronously waits for all of the source tasks to complete. The type of the task results. The tasks to wait for. May not be null. DANGEROUS! Ignores the completion of this task. Also ignores exceptions. The task to ignore. DANGEROUS! Ignores the completion and results of this task. Also ignores exceptions. The task to ignore. Creates a new collection of tasks that complete in order. The type of the results of the tasks. The tasks to order by completion. May not be null. Creates a new collection of tasks that complete in order. The tasks to order by completion. May not be null. Provides extension methods for task factories. Queues work to the task factory and returns a representing that work. If the task factory does not specify a task scheduler, the thread pool task scheduler is used. The . May not be null. The action delegate to execute. May not be null. The started task. Queues work to the task factory and returns a representing that work. If the task factory does not specify a task scheduler, the thread pool task scheduler is used. The . May not be null. The action delegate to execute. May not be null. The started task. Queues work to the task factory and returns a proxy representing that work. If the task factory does not specify a task scheduler, the thread pool task scheduler is used. The . May not be null. The action delegate to execute. May not be null. The started task. Queues work to the task factory and returns a proxy representing that work. If the task factory does not specify a task scheduler, the thread pool task scheduler is used. The . May not be null. The action delegate to execute. May not be null. The started task. Helper methods for working with tasks. Executes a delegate synchronously, and captures its result in a task. The returned task is already completed. The delegate to execute synchronously. Executes a delegate synchronously, and captures its result in a task. The returned task is already completed. The delegate to execute synchronously. Attempts to prepare the exception for re-throwing by preserving the stack trace. The returned exception should be immediately thrown. The exception. May not be null. The that was passed into this method.