TryCatch.Catches Property


The collection of Catch elements to be checked when the Try activity throws an exception.

 property System::Collections::ObjectModel::Collection<System::Activities::Statements::Catch ^> ^ Catches { System::Collections::ObjectModel::Collection<System::Activities::Statements::Catch ^> ^ get(); };
public System.Collections.ObjectModel.Collection<System.Activities.Statements.Catch> Catches { get; }
member this.Catches : System.Collections.ObjectModel.Collection<System.Activities.Statements.Catch>
Public ReadOnly Property Catches As Collection(Of Catch)

Property Value


The catch collection.



The following code sample demonstrates setting the Catches property of a TransactionScope activity. This example is from the Nesting of TransactionScope within a service sample.

Once placed in the designer, Catch activities cannot be reordered in the designer. To reorder the collection of Catch activities, either delete and re-add them in the correct order, or use the xaml (code) view for the workflow.


Catches are evaluated in the order in which they are added to the collection. If an exact match for the exception type is found, the matching Catch activity is executed. If no exact match is found, the Catch with the closest matching ExceptionType is executed.

Applies to