Search Results for

    Show / Hide Table of Contents

    Class ContextualizedAction<T>

    Represents an Action<T> that can be executed on a worker thread with an associated context object.

    Inheritance
    object
    ContextualizedAction<T>
    Implements
    IContextualizedAction
    Namespace: TriLibCore.General
    Assembly: TriLibCore.Source.dll
    Syntax
    public class ContextualizedAction<T> : IContextualizedAction
    Type Parameters
    Name Description
    T

    The type of the context object passed to the action.

    Constructors

    ContextualizedAction(Action<T>, T)

    Initializes a new instance of the ContextualizedAction<T> class using the given action and context.

    Declaration
    public ContextualizedAction(Action<T> action, T context)
    Parameters
    Type Name Description
    Action<T> action

    The action to be executed.

    T context

    The context object passed to the action.

    Fields

    Action

    Action to be invoked on the worker thread.

    Declaration
    public readonly Action<T> Action
    Field Value
    Type Description
    Action<T>

    Context

    Context object passed to the action during execution.

    Declaration
    public readonly T Context
    Field Value
    Type Description
    T

    Properties

    Completed

    Gets a value indicating whether the action has completed execution. If the context implements IAwaitable, this value reflects the awaitable completion state; otherwise, it always returns false.

    Declaration
    public bool Completed { get; }
    Property Value
    Type Description
    bool

    Methods

    GetContext()

    Gets the asset loader context associated with this action, if available.

    Declaration
    public AssetLoaderContext GetContext()
    Returns
    Type Description
    AssetLoaderContext

    The underlying AssetLoaderContext if the context implements IAssetLoaderContext; otherwise, null.

    Invoke()

    Invokes the action on the worker thread, updating the awaitable completion state before and after execution when supported.

    Declaration
    public void Invoke()

    ToString()

    Returns a string that represents the current action and its completion state.

    Declaration
    public override string ToString()
    Returns
    Type Description
    string

    A string containing the target type, method name, and completion status, or Invalid Action if the action is null.

    Overrides
    Object.ToString()

    Implements

    IContextualizedAction

    Extension Methods

    IObjectExtensions.TryToDispose<T>(object)
    In this article
    Back to top TriLib documentation