Class OptionsContainer<T>
Base class for options.
public abstract class OptionsContainer<T> where T : OptionsContainer<T>
Type Parameters
TDerived type.
- Inheritance
-
objectOptionsContainer<T>
- Derived
- Extension Methods
Constructors
OptionsContainer()
protected OptionsContainer()
OptionsContainer(OptionsContainer<T>)
protected OptionsContainer(OptionsContainer<T> options)
Parameters
optionsOptionsContainer<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
objTA
Type Parameters
TA
Clone()
protected abstract T Clone()
Returns
- T
FindOrDefault<TSet>(TSet)
public TSet FindOrDefault<TSet>(TSet defaultOptions) where TSet : class, IOptionSet
Parameters
defaultOptionsTSet
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
nullif set with typeTSetnot found in options.
Type Parameters
TSetOptions 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
TSetOptions set type.
Reapply<TA>(TA, OptionsContainer<T>)
protected Action? Reapply<TA>(TA obj, OptionsContainer<T> previousContainer)
Parameters
objTApreviousContainerOptionsContainer<T>
Returns
Type Parameters
TA
WithOptions(IOptionSet)
Adds or replace IOptionSet instance based on concrete implementation type.
public virtual T WithOptions(IOptionSet options)
Parameters
optionsIOptionSetSet of options.
Returns
- T
New options object with
optionsapplied.
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
optionSetterFunc<TSet, TSet>New option set creation delegate. Takes current options set as parameter.
Returns
- T
New options object (if
optionSettercreated new options set).
Type Parameters
TSetIOptionSet concrete type.