SaaS CMS has officially launched! Learn more now.

Class OptionsBase<TFluentType, TOptionType>

Base class for options supporting fluent operations based on a specifiec option type

Inheritance
System.Object
OptionsBase<TFluentType, TOptionType>
Implements
System.Collections.Generic.IEnumerable<TOptionType>
System.Collections.IEnumerable
Namespace: EPiServer.Core.Internal
Assembly: EPiServer.dll
Version: 12.0.3
Syntax
public abstract class OptionsBase<TFluentType, TOptionType> : Object, IEnumerable<TOptionType>, IEnumerable where TFluentType : class
Type Parameters
Name Description
TFluentType
TOptionType

Constructors

OptionsBase()

Declaration
protected OptionsBase()

Methods

Add<T>(T)

Adds a new option

Declaration
public TFluentType Add<T>(T option)
    where T : TOptionType
Parameters
Type Name Description
T option

The option instance

Returns
Type Description
TFluentType

The option container

Type Parameters
Name Description
T

The type of option

Remarks

It will throw if the item already exist, use Set<T>(T) to overwrite.

Get<T>()

Get an option of specified type or default(T) if option does not exist

Declaration
public T Get<T>()
    where T : TOptionType
Returns
Type Description
T

The option of specified type or default(T) if option does not exist

Type Parameters
Name Description
T

The type of option

Set<T>(T)

Sets a new option

Declaration
public TFluentType Set<T>(T option)
    where T : TOptionType
Parameters
Type Name Description
T option

The option instance

Returns
Type Description
TFluentType

The option container

Type Parameters
Name Description
T

The type of option

Remarks

If an option alreay exist of same type it will be overwritten

Setup<T>(Action<T>)

Setup a property on a option

Declaration
public TFluentType Setup<T>(Action<T> action)
    where T : TOptionType, new()
Parameters
Type Name Description
System.Action<T> action

The action that configures the option

Returns
Type Description
TFluentType

The option container

Type Parameters
Name Description
T

The type of option

Remarks

If an option alreay exist of same type it will not be overwritten

Implements

System.Collections.Generic.IEnumerable<>
System.Collections.IEnumerable

Extension Methods