Search Results for

    Show / Hide Table of Contents

    Class Context<T>

    A generic context class for allowing nested contexts.

    Inheritance
    System.Object
    Context<T>
    Implements
    System.IDisposable
    Inherited Members
    System.Object.ToString()
    System.Object.Equals(System.Object)
    System.Object.Equals(System.Object, System.Object)
    System.Object.ReferenceEquals(System.Object, System.Object)
    System.Object.GetHashCode()
    System.Object.GetType()
    System.Object.MemberwiseClone()
    Namespace: ImageVault.Common.Lib
    Assembly: ImageVault.Common.dll
    Syntax
    public class Context<T> : IDisposable
    Type Parameters
    Name Description
    T
    Remarks

    2008-05-14 Administrator: Created

    Constructors

    Context(T)

    Initializes a new instance of the Context class.

    Declaration
    public Context(T instance)
    Parameters
    Type Name Description
    T instance

    The instance to populate the context with

    Properties

    CurrentContext

    Gets the CurrentContext of the Context

    Declaration
    public static Context<T> CurrentContext { get; }
    Property Value
    Type Description
    Context<T>

    CurrentInstance

    Gets the CurrentInstance of the Context

    Declaration
    public static T CurrentInstance { get; }
    Property Value
    Type Description
    T
    Exceptions
    Type Condition
    System.ArgumentException

    If no CurrentContext exist.

    Instance

    Gets the Instance of the Context

    Declaration
    public T Instance { get; }
    Property Value
    Type Description
    T

    Methods

    Add(T)

    Adds a instance to the context

    Declaration
    public static Context<T> Add(T item)
    Parameters
    Type Name Description
    T item

    The item to add

    Returns
    Type Description
    Context<T>

    The created Context<T>

    Remarks

    Equivalent to creating a new Context<T>(item)

    Clear()

    Clears all present contexts

    Declaration
    public static void Clear()

    CurrentInstanceOrDefault(T)

    Gets the current instance (if any exists) or the default one if no context exists.

    Declaration
    public static T CurrentInstanceOrDefault(T defaultInstance)
    Parameters
    Type Name Description
    T defaultInstance

    The instance to return if no current context exists.

    Returns
    Type Description
    T

    The CurrentInstance if a CurrentContext exists; otherwize the defaultInstance is returned

    Dispose()

    Performs application-defined tasks associated with freeing, releasing, or resetting unmanaged resources.

    Declaration
    public void Dispose()

    Dispose(Boolean)

    Releases the resources used by the Context<T>.

    Declaration
    protected void Dispose(bool disposing)
    Parameters
    Type Name Description
    System.Boolean disposing

    Set to true to release both managed and unmanaged resources; false to release only unmanaged resources.

    Implements

    System.IDisposable

    Extension Methods

    EnumExtensions.GetNames<TEnum>(TEnum)
    In This Article
    Back to top (c) Meriworks 2002-2022