Table of Contents

Class BuildOptionExtensions

Namespace
Invex.Atom.Build.BuildOptions
Assembly
Invex.Atom.Build.dll

Provides extension members for querying IBuildOption instances from option collections and build definitions.

public static class BuildOptionExtensions
Inheritance
object
BuildOptionExtensions

Remarks

Members are exposed as static extensions on the option type itself, e.g. MyOption.Get(options) or MyToggleOption.IsEnabled(definition). When multiple options of the same type are present, the last occurrence wins.

Methods

GetOptionsGrouped<T, TKey>(IEnumerable<IBuildOption>, Func<T, TKey>)

Gets options of type T, keeping only the last occurrence per group key.

public static IReadOnlyList<T> GetOptionsGrouped<T, TKey>(IEnumerable<IBuildOption> options, Func<T, TKey> groupBy) where T : notnull, IBuildOption where TKey : notnull

Parameters

options IEnumerable<IBuildOption>

The options to search.

groupBy Func<T, TKey>

A function that selects the grouping key for each option.

Returns

IReadOnlyList<T>

The last matching option for each distinct key.

Type Parameters

T
TKey

The type of the grouping key.

GetOptions<T>(IEnumerable<IBuildOption>)

Gets all options of type T from the provided options.

public static IReadOnlyList<T> GetOptions<T>(IEnumerable<IBuildOption> options) where T : notnull, IBuildOption

Parameters

options IEnumerable<IBuildOption>

The options to search.

Returns

IReadOnlyList<T>

All matching options, in order of appearance.

Type Parameters

T

Get<T>(IEnumerable<IBuildOption>)

Gets the last option of type T from the provided options.

public static T? Get<T>(IEnumerable<IBuildOption> options) where T : notnull, IBuildOption

Parameters

options IEnumerable<IBuildOption>

The options to search.

Returns

T

The last matching option, or null if none is present.

Type Parameters

T

IsEnabled<T>(IEnumerable<IBuildOption>)

Determines whether the last option of type T in the provided options is present and enabled.

public static bool IsEnabled<T>(IEnumerable<IBuildOption> options) where T : notnull, ToggleBuildOption

Parameters

options IEnumerable<IBuildOption>

The options to search.

Returns

bool

true if the option is present and enabled; otherwise, false.

Type Parameters

T