Skip to content

ExperimentItemFeatureCollection

NexusLabs.Foundry.Evaluation

NexusLabs.Foundry.Evaluation.Experiments

ExperimentItemFeatureCollection Class

Provides exact-type access to adapter-owned features for one experiment item scope.

public sealed class ExperimentItemFeatureCollection

Inheritance System.Object 🡒 ExperimentItemFeatureCollection

Remarks

Feature objects remain valid for the item lifetime across repeated scope activation and deactivation. Per-activation state must be resolved through the feature rather than captured when the feature is registered.

Methods

ExperimentItemFeatureCollection.GetRequired<TFeature>() Method

Gets the feature registered for the exact requested type.

public TFeature GetRequired<TFeature>()
    where TFeature : class;

Type parameters

TFeature

The adapter-owned feature type.

Returns

TFeature
The registered feature.

Exceptions

System.Collections.Generic.KeyNotFoundException
The exact feature type is not registered.

ExperimentItemFeatureCollection.TryGet<TFeature>(TFeature) Method

Attempts to get the feature registered for the exact requested type.

public bool TryGet<TFeature>(out TFeature? feature)
    where TFeature : class;

Type parameters

TFeature

The adapter-owned feature type.

Parameters

feature TFeature

The registered feature when found.

Returns

System.Boolean
true when the exact feature type is registered.