Class OptionsContainer<T>
Base class for options.
public abstract class OptionsContainer<T> where T : OptionsContainer<T>
Type Parameters
T
Derived type.
- Inheritance
-
OptionsContainer<T>
- Derived
- Extension Methods
Constructors
OptionsContainer()
protected OptionsContainer()
OptionsContainer(OptionsContainer<T>)
protected OptionsContainer(OptionsContainer<T> options)
Parameters
options
OptionsContainer<T>
Properties
OptionSets
Provides access to option sets, stored in current options object.
public virtual IEnumerable<IOptionSet> OptionSets { get; }
Property Value
Methods
Apply<TA>(TA)
protected void Apply<TA>(TA obj)
Parameters
obj
TA
Type Parameters
TA
Clone()
protected abstract T Clone()
Returns
- T
FindOrDefault<TSet>(TSet)
public TSet FindOrDefault<TSet>(TSet defaultOptions) where TSet : class, IOptionSet
Parameters
defaultOptions
TSet
Returns
- TSet
Type Parameters
TSet
Find<TSet>()
Search for options set by set type TSet
.
public virtual TSet? Find<TSet>() where TSet : class, IOptionSet
Returns
- TSet
Options set or
null
if set with typeTSet
not found in options.
Type Parameters
TSet
Options set type.
Get<TSet>()
Returns options set by set type TSet
. If options doesn't contain specific options set, it is created and added to options.
public virtual TSet Get<TSet>() where TSet : class, IOptionSet, new()
Returns
- TSet
Returns options set by set type
TSet
. If options doesn't contain specific options set, it is created and added to options.
Type Parameters
TSet
Options set type.
WithOptions(IOptionSet)
Adds or replace IOptionSet instance based on concrete implementation type.
public virtual T WithOptions(IOptionSet options)
Parameters
options
IOptionSetSet of options.
Returns
- T
New options object with
options
applied.
WithOptions<TSet>(Func<TSet, TSet>)
Adds or replace IOptionSet instance, returned by optionSetter
delegate.
public T WithOptions<TSet>(Func<TSet, TSet> optionSetter) where TSet : class, IOptionSet, new()
Parameters
optionSetter
Func<TSet, TSet>New option set creation delegate. Takes current options set as parameter.
Returns
- T
New options object (if
optionSetter
created new options set).
Type Parameters
TSet
IOptionSet concrete type.