Open sandboxFocus

Method WithFilter

WithFilter(Func<ISuppressibleDiagnostic, bool>)

Creates a filtered suppression that only suppresses diagnostics matching the specified predicate.

Declaration
public ISuppression WithFilter(Func<ISuppressibleDiagnostic, bool> filter)
Parameters
Type Name Description
Func<ISuppressibleDiagnostic, bool> filter

A predicate that determines which diagnostics should be suppressed. The predicate receives an ISuppressibleDiagnostic and returns true to suppress the diagnostic or false to allow it.

Returns
Type Description
ISuppression

A new suppression instance that applies only to diagnostics matching the filter criteria.

Remarks

Use this method to selectively suppress diagnostics based on their message text, arguments, or other properties, rather than suppressing all diagnostics with the same ID.