Bewerken

Delen via


TransactionScope.Timeout Property

Definition

Gets or sets the TimeSpan that indicates the timeout period for the transaction used for this TransactionScope.

public:
 property System::Activities::InArgument<TimeSpan> ^ Timeout { System::Activities::InArgument<TimeSpan> ^ get(); void set(System::Activities::InArgument<TimeSpan> ^ value); };
public System.Activities.InArgument<TimeSpan> Timeout { get; set; }
member this.Timeout : System.Activities.InArgument<TimeSpan> with get, set
Public Property Timeout As InArgument(Of TimeSpan)

Property Value

The TimeSpan that indicates the timeout period for the transaction used for this TransactionScope.

Examples

The following code sample demonstrates setting the Timeout property of a TransactionScope activity.

new TransactionScope
{
    Body = new Sequence
    {
        Activities =
        {
            new WriteLine { Text = "    Begin TransactionScope" },

            new PrintTransactionId(),

            new TransactionScopeTest(),

            new WriteLine { Text = "    End TransactionScope" },
        },
    },
},

Remarks

This property is read-only at run time. If the value is set at run time, an InvalidOperationException is thrown.

Applies to