Open sandboxFocus

Method Type

Type(IEligibilityBuilder<IHasType>)

Gets an IEligibilityBuilder for the type of the declaration validated by the given IEligibilityBuilder.

Declaration
public static IEligibilityBuilder<IType> Type(this IEligibilityBuilder<IHasType> eligibilityBuilder)
Parameters
Type Name Description
IEligibilityBuilder<IHasType> eligibilityBuilder

The eligibility builder for a declaration that has a type (field, property, parameter, etc.).

Returns
Type Description
IEligibilityBuilder<IType>

An eligibility builder for the type of the declaration.

Remarks

Use this method to add requirements on the type of a field, property, or parameter. For example, you can require that a field is of a specific type, or implements a specific interface.

When validation fails on the type, the error message will clearly indicate that it's the type that doesn't meet the requirement.