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
setupAction<TOptions>The delegate that will configure the public read-write properties of
TOptions.
Returns
- TOptions
A default constructed instance of
TOptionsinitialized with the options ofsetup.
Type Parameters
TOptionsThe 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
factoryAction<T>The delegate that will initialize the public write properties of
T.
Returns
- T
A default constructed instance of
Tinitialized withfactory.
Type Parameters
TThe type of the class having a default constructor.