docs.unity.cn
    Show / Hide Table of Contents

    Class ContainerPropertyBag<TContainer>

    Base class for implementing a static property bag for a specified container type. This is an abstract class.

    Inheritance
    Object
    PropertyBag<TContainer>
    ContainerPropertyBag<TContainer>
    Inherited Members
    PropertyBag<TContainer>.Accept(ITypeVisitor)
    PropertyBag<TContainer>.IPropertyBag.Accept(IPropertyBagVisitor, Object)
    PropertyBag<TContainer>.IPropertyBag<TContainer>.Accept(IPropertyBagVisitor, TContainer)
    PropertyBag<TContainer>.IPropertyBag<TContainer>.GetProperties()
    PropertyBag<TContainer>.IPropertyBag<TContainer>.GetProperties(TContainer)
    PropertyBag<TContainer>.InstantiationKind
    PropertyBag<TContainer>.Instantiate()
    PropertyBag<TContainer>.CreateInstance()
    PropertyBag<TContainer>.TryCreateInstance(TContainer)
    Object.ToString()
    Object.Equals(Object)
    Object.Equals(Object, Object)
    Object.ReferenceEquals(Object, Object)
    Object.GetHashCode()
    Object.GetType()
    Object.MemberwiseClone()
    Namespace: Unity.Properties
    Syntax
    public abstract class ContainerPropertyBag<TContainer> : PropertyBag<TContainer>, IPropertyBag<TContainer>, IPropertyBag, IPropertyBagRegister, IConstructor<TContainer>, IConstructor, INamedProperties<TContainer>
    Type Parameters
    Name Description
    TContainer

    The container type.

    Remarks

    A ContainerPropertyBag<TContainer> is used to describe and traverse the properties for a specified TContainer type.

    In order for properties to operate on a type, a ContainerPropertyBag<TContainer> must exist and be pre-registered for that type.

    NOTE In editor use cases property bags can be generated dynamically through reflection. (see Unity.Properties.Reflection)

    Methods

    AddProperty<TValue>(Property<TContainer, TValue>)

    Adds a Property<TContainer, TValue> to the property bag.

    Declaration
    protected void AddProperty<TValue>(Property<TContainer, TValue> property)
    Parameters
    Type Name Description
    Property<TContainer, TValue> property

    The Property<TContainer, TValue> to add.

    Type Parameters
    Name Description
    TValue

    The value type for the given property.

    GetProperties()

    Implement this method to return a PropertyCollection<TContainer> that can enumerate through all properties for the TContainer.

    Declaration
    public override PropertyCollection<TContainer> GetProperties()
    Returns
    Type Description
    PropertyCollection<TContainer>

    A PropertyCollection<TContainer> structure which can enumerate each property.

    Overrides
    Unity.Properties.PropertyBag<TContainer>.GetProperties()

    GetProperties(ref TContainer)

    Implement this method to return a PropertyCollection<TContainer> that can enumerate through all properties for the TContainer.

    Declaration
    public override PropertyCollection<TContainer> GetProperties(ref TContainer container)
    Parameters
    Type Name Description
    TContainer container

    The container hosting the data.

    Returns
    Type Description
    PropertyCollection<TContainer>

    A PropertyCollection<TContainer> structure which can enumerate each property.

    Overrides
    Unity.Properties.PropertyBag<TContainer>.GetProperties(TContainer)

    TryGetProperty(ref TContainer, String, out IProperty<TContainer>)

    Gets the property associated with the specified name.

    Declaration
    public bool TryGetProperty(ref TContainer container, string name, out IProperty<TContainer> property)
    Parameters
    Type Name Description
    TContainer container

    The container hosting the data.

    String name

    The name of the property to get.

    IProperty<TContainer> property

    When this method returns, contains the property associated with the specified name, if the name is found; otherwise, null.

    Returns
    Type Description
    Boolean

    true if the INamedProperties<TContainer> contains a property with the specified name; otherwise, false.

    Implements
    INamedProperties<TContainer>.TryGetProperty(ref TContainer, String, out IProperty<TContainer>)
    Back to top Copyright © 2023 Unity Technologies — Terms of use
    Generated by DocFX
    on Wednesday, July 26, 2023