MixedReality-WebRTC MixedReality-WebRTC
Search Results for

    Show / Hide Table of Contents

    Class TaskExtensions

    Collection of extension methods for Task.

    Inheritance
    Object
    TaskExtensions
    Namespace: Microsoft.MixedReality.WebRTC
    Assembly: Microsoft.MixedReality.WebRTC.dll
    Syntax
    public static class TaskExtensions : object

    Methods

    | Improve this Doc View Source

    AsTask(CancellationToken)

    A simple helper to enable "awaiting" a by creating a task wrapping it.

    Declaration
    public static Task AsTask(this CancellationToken cancellationToken)
    Parameters
    Type Name Description
    CancellationToken cancellationToken

    The to await.

    Returns
    Type Description
    Task

    The task that can be awaited.

    | Improve this Doc View Source

    IgnoreCancellation(Task)

    Prevents or from trickling up.

    Declaration
    public static Task IgnoreCancellation(this Task task)
    Parameters
    Type Name Description
    Task task

    The task to ignore exceptions for.

    Returns
    Type Description
    Task

    A wrapping task for the given task.

    | Improve this Doc View Source

    IgnoreCancellation<T>(Task<T>, T)

    Prevents or from trickling up.

    Declaration
    public static Task<T> IgnoreCancellation<T>(this Task<T> task, T defaultCancellationReturn = null)
    Parameters
    Type Name Description
    Task<T> task

    The task to ignore exceptions for.

    T defaultCancellationReturn

    The default value to return in case the task is cancelled.

    Returns
    Type Description
    Task<T>

    A wrapping task for the given task.

    Type Parameters
    Name Description
    T

    The result type of the Task.

    | Improve this Doc View Source

    Unless(Task, CancellationToken)

    The task will be awaited until the cancellation token is triggered. (await task unless cancelled).

    Declaration
    public static Task Unless(this Task task, CancellationToken cancellationToken)
    Parameters
    Type Name Description
    Task task

    The task to await.

    CancellationToken cancellationToken

    The cancellation token to stop awaiting.

    Returns
    Type Description
    Task

    The task that can be awaited unless the cancellation token is triggered.

    Remarks

    This is different from cancelling the task. The use case is to enable a calling method bow out of the await that it can't cancel, but doesn't require completion/cancellation in order to cancel it's own execution.

    • Improve this Doc
    • View Source
    In This Article
    Back to top Generated by DocFX