Open sandboxFocus

Method MustBeInstanceOfAnyType

MustBeInstanceOfAnyType<T>(IEligibilityBuilder<T>, params Type[])

Requires the validated object to be of one of the specified metadata types. Note that this validates the object itself, not the declaration that it represents. For instance, if the object is an IParameter and the types parameter contains typeof(string), this method will fail with an exception because no conversion exists from IParameter to string.

Declaration
public static void MustBeInstanceOfAnyType<T>(this IEligibilityBuilder<T> eligibilityBuilder, params Type[] types) where T : class
Parameters
Type Name Description
IEligibilityBuilder<T> eligibilityBuilder

The eligibility builder.

Type[] types

The metadata types that the declaration can be an instance of (e.g., typeof(IMethod), typeof(IProperty)).

Type Parameters
Name Description
T

The type of declaration being validated.