Class ActionExtensions
- Namespace
- Cuemon.Extensions
- Assembly
- Cuemon.Extensions.Core.dll
Extension methods for the Action delegates.
public static class ActionExtensions
- Inheritance
-
ActionExtensions
Methods
Configure<TOptions>(Action<TOptions>)
Provides a generic way to support the options pattern which enables using custom options classes to represent a group of related settings.
public static TOptions Configure<TOptions>(this Action<TOptions> setup)
where TOptions : class, IParameterObject, new()
Parameters
setup
Action<TOptions>The delegate that will configure the public read-write properties of
TOptions
.
Returns
- TOptions
A default constructed instance of
TOptions
initialized with the options ofsetup
.
Type Parameters
TOptions
The type of the custom options class.
- See Also
CreateInstance<T>(Action<T>)
Provides a generic way to initialize the default, parameterless constructed instance of T
.
public static T CreateInstance<T>(this Action<T> factory)
where T : class, new()
Parameters
factory
Action<T>The delegate that will initialize the public write properties of
T
.
Returns
- T
A default constructed instance of
T
initialized withfactory
.
Type Parameters
T
The type of the class having a default constructor.