When<TOutput>()
Converts to an IEligibilityBuilder<T> for a more specific type, but only applies rules conditionally when the declaration is of the specified type. Does not add an eligibility requirement.
Declaration
public IEligibilityBuilder<TOutput> When<TOutput>() where TOutput : class, TReturns
| Type | Description |
|---|---|
| IEligibilityBuilder<TOutput> | An eligibility builder for |
Type Parameters
| Name | Description |
|---|---|
| TOutput | The more specific type to convert to (must be derived from or the same as |
Remarks
If the validated object is not of type TOutput, the rules added to the returned builder
are simply ignored (the declaration is not made ineligible). This is equivalent to using If<T>(IEligibilityBuilder<T>, Predicate<T>)
followed by To<TOutput>().
Use this when you want to add type-specific rules without requiring that all declarations be of that type. For example, you might want to add special rules for methods without making fields ineligible.