MustSatisfy<T>(IEligibilityBuilder<T>, Predicate<T>, Func<IDescribedObject<T>, FormattableString>)
Adds a custom eligibility condition to the given IEligibilityBuilder, where the condition must be satisfied by the declaration in order to be eligible for the aspect.
Declaration
public static void MustSatisfy<T>(this IEligibilityBuilder<T> eligibilityBuilder, Predicate<T> predicate, Func<IDescribedObject<T>, FormattableString> getJustification) where T : classParameters
| Type | Name | Description |
|---|---|---|
| IEligibilityBuilder<T> | eligibilityBuilder | The parent IEligibilityBuilder. |
| Predicate<T> | predicate | A predicate that returns |
| Func<IDescribedObject<T>, FormattableString> | getJustification | A delegate called when the |
Type Parameters
| Name | Description |
|---|---|
| T |
Remarks
Use this method when standard eligibility methods like MustNotBeStatic(IEligibilityBuilder<IMemberOrNamedType>) or MustNotBeAbstract(IEligibilityBuilder<IMemberOrNamedType>)
are insufficient for your requirements. The getJustification message should state what the declaration
must be (e.g., "must not be a record type") rather than what it must not be, as this convention
combines better when multiple conditions are violated.
Do not format the string yourself—use a raw interpolated string. The framework uses a custom formatter to ensure proper rendering of declarations.