Open sandboxFocus

Method Convert

Convert<T>(IEligibilityBuilder<T>)

Gets a converter object that allows transforming the given IEligibilityBuilder into an IEligibilityBuilder for a more specific declaration type.

Declaration
public static EligibilityExtensions.Converter<T> Convert<T>(this IEligibilityBuilder<T> eligibilityBuilder) where T : class
Parameters
Type Name Description
IEligibilityBuilder<T> eligibilityBuilder

The eligibility builder to convert.

Returns
Type Description
EligibilityExtensions.Converter<T>

A EligibilityExtensions.Converter<T> object that provides methods like To<TTarget>() and When<TTarget>() for type conversion.

Type Parameters
Name Description
T

The type of declaration being validated.

Remarks

Use this method when you need to add eligibility rules for a more specific type. For example, if you have an IEligibilityBuilder<T> for IMember and want to add rules specific to IMethod, use builder.Convert().To<IMethod>().

The To<TTarget>() method adds an implicit rule that the declaration must be of type TTarget, while When<TTarget>() only evaluates rules when the declaration is of that type without adding an eligibility requirement.