docs.unity.cn
    Show / Hide Table of Contents

    Class ContextContainer

    ContextContainer is a Dictionary like storage where the key is a generic parameter and the value is of the same type.

    Inheritance
    Object
    ContextContainer
    Inherited Members
    Object.ToString()
    Object.Equals(Object)
    Object.Equals(Object, Object)
    Object.ReferenceEquals(Object, Object)
    Object.GetHashCode()
    Object.GetType()
    Object.MemberwiseClone()
    Namespace: UnityEngine.Rendering
    Syntax
    public class ContextContainer : IDisposable

    Methods

    Contains<T>()

    Check if the value of type T has previously been created.

    Declaration
    public bool Contains<T>()
        where T : ContextItem, new()
    Returns
    Type Description
    Boolean

    Returns true if the value exists and false otherwise.

    Type Parameters
    Name Description
    T

    Is the class which you are trying to fetch. T has to inherit from ContextContainerItem

    Create<T>()

    Creates the value of type T.

    Declaration
    public T Create<T>()
        where T : ContextItem, new()
    Returns
    Type Description
    T

    The value of type T created inside the ContextContainer.

    Type Parameters
    Name Description
    T

    Is the class which you are trying to fetch. T has to inherit from ContextContainerItem

    Exceptions
    Type Condition
    InvalidOperationException

    Thown if you try to create the value of type T agian after it is already created.

    Dispose()

    Call Dispose to remove the created values.

    Declaration
    public void Dispose()
    Implements
    IDisposable.Dispose()

    Get<T>()

    Retrives a T of class ContextContainerItem if it was previously created without it being disposed.

    Declaration
    public T Get<T>()
        where T : ContextItem, new()
    Returns
    Type Description
    T

    The value created previously using Create<T> .

    Type Parameters
    Name Description
    T

    Is the class which you are trying to fetch. T has to inherit from ContextContainerItem

    Exceptions
    Type Condition
    InvalidOperationException

    This is thown if the value isn't previously created.

    GetOrCreate<T>()

    Creates the value of type T if the value is not previously created otherwise try to get the value of type T.

    Declaration
    public T GetOrCreate<T>()
        where T : ContextItem, new()
    Returns
    Type Description
    T

    Returns the value of type T which is created or retrived.

    Type Parameters
    Name Description
    T

    Is the class which you are trying to fetch. T has to inherit from ContextContainerItem

    Extension Methods

    AnalyticsUtils.ToNestedColumn<T>(T, Boolean)
    AnalyticsUtils.ToNestedColumnWithDefault<T>(T, T, Boolean)
    ReflectionUtils.Invoke(Object, String, Object[])
    ReflectionUtils.SetField(Object, String, Object)
    ReflectionUtils.GetField(Object, String)
    ReflectionUtils.GetFields(Object)
    Back to top Copyright © 2023 Unity Technologies — Terms of use
    Generated by DocFX
    on 08 September 2023