Compartir a través de


TaskFailureDetails.IsCausedBy<T> Method

Definition

Returns true if the task failure was provided by the specified exception type.

public bool IsCausedBy<T> () where T : Exception;
member this.IsCausedBy : unit -> bool (requires 'T :> Exception)
Public Function IsCausedBy(Of T As Exception) () As Boolean

Type Parameters

T

The type of exception to test against.

Returns

Returns true if the ErrorType value matches T; false otherwise.

Remarks

This method allows checking if a task failed due to an exception of a specific type by attempting to load the type specified in ErrorType. If the exception type cannot be loaded for any reason, this method will return false. Base types are supported.

Applies to