Class Tweaker
- Namespace
- Cuemon
- Assembly
- Cuemon.Core.dll
Provides a way to change any instance of the same generic type.
public static class Tweaker
- Inheritance
-
Tweaker
Methods
Adjust<T>(T, Func<T, T>)
Adjust the specified value
with the function delegate converter
.
public static T Adjust<T>(T value, Func<T, T> converter)
Parameters
value
TThe value to convert.
converter
Func<T, T>The function delegate that will convert the specified
value
.
Returns
- T
The
value
in its original or converted form.
Type Parameters
T
The type of the value to convert.
Remarks
This is thought to be a more severe change than the one provided by Alter<T>(T, Action<T>) (e.g., potentially convert the entire value
to a new instance).
Alter<T>(T, Action<T>)
Adjust the specified value
with the modifier
delegate.
public static T Alter<T>(T value, Action<T> modifier)
Parameters
value
TThe value to adjust.
modifier
Action<T>The delegate that will adjust the specified
value
.
Returns
- T
The
value
in its original or adjusted form.
Type Parameters
T
The type of the value to adjust.
Remarks
This is thought to be a more relaxed change than the one provided by Adjust<T>(T, Func<T, T>) (e.g., applying changes only to the current value
).
Change<T, TResult>(T, Func<T, TResult>)
Converts the specified value
to a value of TResult
.
public static TResult Change<T, TResult>(T value, Func<T, TResult> converter)
Parameters
value
TThe value to convert.
converter
Func<T, TResult>The function delegate that will perform the conversion.
Returns
- TResult
The
value
converted to the specifiedT
.
Type Parameters
T
The type of the value to convert.
TResult
The type of the value to return.
Exceptions
- ArgumentNullException
value
cannot be null.