docs.unity3d.com
    Show / Hide Table of Contents

    Class DelegateProperty<TContainer, TValue>

    Represents a value property.

    Inheritance
    Object
    Property<TContainer, TValue>
    DelegateProperty<TContainer, TValue>
    Inherited Members
    Property<TContainer, TValue>.Name
    Property<TContainer, TValue>.IsReadOnly
    Property<TContainer, TValue>.DeclaredValueType()
    Property<TContainer, TValue>.IProperty<TContainer>.GetValue(TContainer)
    Property<TContainer, TValue>.IProperty<TContainer>.TrySetValue(TContainer, Object)
    Property<TContainer, TValue>.GetValue(TContainer)
    Property<TContainer, TValue>.SetValue(TContainer, TValue)
    Property<TContainer, TValue>.AddAttribute(Attribute)
    Property<TContainer, TValue>.AddAttributes(IEnumerable<Attribute>)
    Property<TContainer, TValue>.HasAttribute<TAttribute>()
    Property<TContainer, TValue>.GetAttribute<TAttribute>()
    Property<TContainer, TValue>.GetAttributes<TAttribute>()
    Property<TContainer, TValue>.GetAttributes()
    Namespace: Unity.Properties
    Syntax
    public class DelegateProperty<TContainer, TValue> : Property<TContainer, TValue>, IProperty<TContainer>, IProperty, IPropertyAccept<TContainer>, IAttributes
    Type Parameters
    Name Description
    TContainer

    The container type this property will access data on.

    TValue

    The value type for this property.

    Remarks

    A DelegateProperty<TContainer, TValue> is the default way to construct properties.

    Constructors

    DelegateProperty(String, PropertyGetter<TContainer, TValue>, PropertySetter<TContainer, TValue>)

    Initializes a new instance of the DelegateProperty<TContainer, TValue> class.

    Declaration
    public DelegateProperty(string name, PropertyGetter<TContainer, TValue> getter, PropertySetter<TContainer, TValue> setter = null)
    Parameters
    Type Name Description
    String name

    The property name.

    PropertyGetter<TContainer, TValue> getter

    The delegate to use when accessing the property value.

    PropertySetter<TContainer, TValue> setter

    The delegate to use when setting the property value.

    Properties

    IsReadOnly

    Gets a value indicating whether the property is read-only or not.

    Declaration
    public override bool IsReadOnly { get; }
    Property Value
    Type Description
    Boolean
    Overrides
    Unity.Properties.Property<TContainer, TValue>.IsReadOnly

    Name

    Gets the name of the property.

    Declaration
    public override string Name { get; }
    Property Value
    Type Description
    String
    Overrides
    Unity.Properties.Property<TContainer, TValue>.Name

    Methods

    GetValue(ref TContainer)

    Returns the property value of a specified container.

    Declaration
    public override TValue GetValue(ref TContainer container)
    Parameters
    Type Name Description
    TContainer container

    The container whose property value will be returned.

    Returns
    Type Description
    TValue

    The property value of the given container.

    Overrides
    Unity.Properties.Property<TContainer, TValue>.GetValue(TContainer)

    SetValue(ref TContainer, TValue)

    Sets the property value of a specified container.

    Declaration
    public override void SetValue(ref TContainer container, TValue value)
    Parameters
    Type Name Description
    TContainer container

    The container whose property value will be set.

    TValue value

    The new property value.

    Overrides
    Unity.Properties.Property<TContainer, TValue>.SetValue(TContainer, TValue)
    Back to top
    Terms of use
    Copyright © 2023 Unity Technologies — Terms of use
    • Legal
    • Privacy Policy
    • Cookies
    • Do Not Sell or Share My Personal Information
    • Your Privacy Choices (Cookie Settings)
    "Unity", Unity logos, and other Unity trademarks are trademarks or registered trademarks of Unity Technologies or its affiliates in the U.S. and elsewhere (more info here). Other names or brands are trademarks of their respective owners.
    Generated by DocFX on 18 October 2023