TryCatch.Catches Property

Definition

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

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

Property Value

Collection<Catch>

The catch collection.

Attributes

Examples

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.

Remarks

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