Table of Contents

Class SetValueCommand

Namespace
NanoByte.Common.Undo
Assembly
NanoByte.Common.dll

Factory methods for SetValueCommand<T>.

public static class SetValueCommand
Inheritance
object
SetValueCommand

Methods

ForNullable<T>(Func<T?>, Action<T?>, T?)

Creates a new command for setting a nullable value.

public static SetValueCommand<T?> ForNullable<T>(Func<T?> getValue, Action<T?> setValue, T? newValue)

Parameters

getValue Func<T>

A delegate that returns the current value.

setValue Action<T>

A delegate that sets the value.

newValue T

The new value to be set.

Returns

SetValueCommand<T>

Type Parameters

T

The type of the value to set.

ForNullable<T>(Expression<Func<T?>>, T?)

Creates a new command for setting a nullable value.

public static SetValueCommand<T?> ForNullable<T>(Expression<Func<T?>> expression, T? newValue)

Parameters

expression Expression<Func<T>>

An expression pointing to the property.

newValue T

The new value to be set.

Returns

SetValueCommand<T>

Type Parameters

T

The type of value the property contains.

For<T>(PropertyPointer<T>, T)

Creates a new command for setting a value.

public static SetValueCommand<T> For<T>(PropertyPointer<T> pointer, T newValue)

Parameters

pointer PropertyPointer<T>

The object controlling how to read/write the value to be modified.

newValue T

The new value to be set.

Returns

SetValueCommand<T>

Type Parameters

T

The type of the value to set.

For<T>(Func<T>, Action<T>, T)

Creates a new command for setting a value.

public static SetValueCommand<T> For<T>(Func<T> getValue, Action<T> setValue, T newValue) where T : notnull

Parameters

getValue Func<T>

A delegate that returns the current value.

setValue Action<T>

A delegate that sets the value.

newValue T

The new value to be set.

Returns

SetValueCommand<T>

Type Parameters

T

The type of the value to set.

For<T>(Expression<Func<T>>, T)

Creates a new command for setting a value.

public static SetValueCommand<T> For<T>(Expression<Func<T>> expression, T newValue) where T : notnull

Parameters

expression Expression<Func<T>>

An expression pointing to the property.

newValue T

The new value to be set.

Returns

SetValueCommand<T>

Type Parameters

T

The type of value the property contains.