Class OptionsContainer<T>
Base class for options.
public abstract class OptionsContainer<T> where T : OptionsContainer<T>
Type Parameters
TDerived type.
- Inheritance
-
OptionsContainer<T>
- Derived
- Inherited Members
- 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.
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.