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 |
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 |
Type Parameters
Name | Description |
---|---|
T | The type of the property. |
Exceptions
Type | Condition |
---|---|
ArgumentNullException |
|
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 |
Type Parameters
Name | Description |
---|---|
T | The type of the property. |
Exceptions
Type | Condition |
---|---|
ArgumentNullException |
|
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 |
Type Parameters
Name | Description |
---|---|
T | The type of the property. |
Exceptions
Type | Condition |
---|---|
ArgumentNullException |
|
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 |
Type Parameters
Name | Description |
---|---|
T | The type of the property. |
TModel | The type of the model. |
Exceptions
Type | Condition |
---|---|
ArgumentNullException |
|