Class SetValueCommand
Factory methods for SetValueCommand<T>.
Namespace: NanoByte.Common.Undo
Assembly: NanoByte.Common.dll
Syntax
public static class SetValueCommand : Object
Methods
For<T>(PropertyPointer<T>, T)
Creates a new command for setting a value.
Declaration
public static SetValueCommand<T> For<T>(PropertyPointer<T> pointer, T newValue)
Parameters
Type | Name | Description |
---|---|---|
PropertyPointer<T> | pointer | The object controlling how to read/write the value to be modified. |
T | newValue | The new value to be set. |
Returns
Type | Description |
---|---|
SetValueCommand<T> |
Type Parameters
Name | Description |
---|---|
T | The type of the value to set. |
For<T>(Func<T>, Action<T>, T)
Creates a new command for setting a value.
Declaration
public static SetValueCommand<T> For<T>(Func<T> getValue, Action<T> setValue, T newValue)
Parameters
Type | Name | Description |
---|---|---|
Func<T> | getValue | A delegate that returns the current value. |
Action<T> | setValue | A delegate that sets the value. |
T | newValue | The new value to be set. |
Returns
Type | Description |
---|---|
SetValueCommand<T> |
Type Parameters
Name | Description |
---|---|
T | The type of the value to set. |
For<T>(Expression<Func<T>>, T)
Creates a new command for setting a value.
Declaration
public static SetValueCommand<T> For<T>(Expression<Func<T>> expression, T newValue)
Parameters
Type | Name | Description |
---|---|---|
Expression<Func<T>> | expression | An expression pointing to the property. |
T | newValue | The new value to be set. |
Returns
Type | Description |
---|---|
SetValueCommand<T> |
Type Parameters
Name | Description |
---|---|
T | The type of value the property contains. |
ForNullable<T>(Func<T>, Action<T>, T)
Creates a new command for setting a nullable value.
Declaration
public static SetValueCommand<T> ForNullable<T>(Func<T> getValue, Action<T> setValue, T newValue)
Parameters
Type | Name | Description |
---|---|---|
Func<T> | getValue | A delegate that returns the current value. |
Action<T> | setValue | A delegate that sets the value. |
T | newValue | The new value to be set. |
Returns
Type | Description |
---|---|
SetValueCommand<T> |
Type Parameters
Name | Description |
---|---|
T | The type of the value to set. |
ForNullable<T>(Expression<Func<T>>, T)
Creates a new command for setting a nullable value.
Declaration
public static SetValueCommand<T> ForNullable<T>(Expression<Func<T>> expression, T newValue)
Parameters
Type | Name | Description |
---|---|---|
Expression<Func<T>> | expression | An expression pointing to the property. |
T | newValue | The new value to be set. |
Returns
Type | Description |
---|---|
SetValueCommand<T> |
Type Parameters
Name | Description |
---|---|
T | The type of value the property contains. |