{!See https://docs.google.com/document/d/1takg_GmIBBKKTj-GHZCwzxohpQz7Bhekivkk72kYMtE/edit for reference implementation of OneTrust, dataLayer and GTM} {!OneTrust Cookies Consent} {!OneTrust Cookies Consent end} {!dataLayer initialization push} {!dataLayer initialization push end} {!Google Tag Manager} {!Google Tag Manager end} Method SetProperty | App UI | 0.5.5
docs.unity3d.com
Search Results for

    Show / Hide Table of Contents

    Method SetProperty

    SetProperty<T>(ref T, T, string?)

    Sets the property and raises the PropertyChanging and PropertyChanged events.

    Declaration
    protected bool SetProperty<T>(ref T field, T newValue, string? propertyName = null)
    Parameters
    Type Name Description
    T field

    The field to set.

    T newValue

    The new value.

    string propertyName

    The name of the property that has changed.

    Returns
    Type Description
    bool

    true if the property has changed, false otherwise.

    Type Parameters
    Name Description
    T

    The type of the property.

    SetProperty<T>(ref T, T, EqualityComparer<T>, string?)

    Sets the property and raises the PropertyChanging and PropertyChanged events.

    Declaration
    protected bool SetProperty<T>(ref T field, T newValue, EqualityComparer<T> comparer, string? propertyName = null)
    Parameters
    Type Name Description
    T field

    The field to set.

    T newValue

    The new value.

    EqualityComparer<T> comparer

    The comparer to use to check if the property has changed.

    string propertyName

    The name of the property that has changed.

    Returns
    Type Description
    bool

    true if the property has changed, false otherwise.

    Type Parameters
    Name Description
    T

    The type of the property.

    Exceptions
    Type Condition
    ArgumentNullException

    comparer is null.

    SetProperty<T>(T, T, Action<T>, string?)

    Sets the property and raises the PropertyChanging and PropertyChanged events.

    Declaration
    protected bool SetProperty<T>(T oldValue, T newValue, Action<T> callback, string? propertyName = null)
    Parameters
    Type Name Description
    T oldValue

    The old value.

    T newValue

    The new value.

    Action<T> callback

    The callback to invoke to set the property.

    string propertyName

    The name of the property that has changed.

    Returns
    Type Description
    bool

    true if the property has changed, false otherwise.

    Type Parameters
    Name Description
    T

    The type of the property.

    Exceptions
    Type Condition
    ArgumentNullException

    callback is null.

    SetProperty<T>(T, T, EqualityComparer<T>, Action<T>, string?)

    Sets the property and raises the PropertyChanging and PropertyChanged events.

    Declaration
    protected bool SetProperty<T>(T oldValue, T newValue, EqualityComparer<T> comparer, Action<T> callback, string? propertyName = null)
    Parameters
    Type Name Description
    T oldValue

    The old value.

    T newValue

    The new value.

    EqualityComparer<T> comparer

    The comparer to use to check if the property has changed.

    Action<T> callback

    The callback to invoke to set the property.

    string propertyName

    The name of the property that has changed.

    Returns
    Type Description
    bool

    true if the property has changed, false otherwise.

    Type Parameters
    Name Description
    T

    The type of the property.

    Exceptions
    Type Condition
    ArgumentNullException

    callback or comparer is null.

    SetProperty<T, TModel>(T, T, TModel, Action<TModel, T>, string?)

    Sets the property and raises the PropertyChanging and PropertyChanged events.

    Declaration
    protected bool SetProperty<T, TModel>(T oldValue, T newValue, TModel model, Action<TModel, T> callback, string? propertyName = null)
    Parameters
    Type Name Description
    T oldValue

    The old value.

    T newValue

    The new value.

    TModel model

    The model to set the property on.

    Action<TModel, T> callback

    The callback to invoke to set the property.

    string propertyName

    The name of the property that has changed.

    Returns
    Type Description
    bool

    true if the property has changed, false otherwise.

    Type Parameters
    Name Description
    T

    The type of the property.

    TModel

    The type of the model.

    Exceptions
    Type Condition
    ArgumentNullException

    callback or model is null.

    In This Article
    Back to top
    Copyright © 2023 Unity Technologies — Trademarks and terms of use
    • Legal
    • Privacy Policy
    • Cookie Policy
    • Do Not Sell or Share My Personal Information
    • Your Privacy Choices (Cookie Settings)