While Class
Executes a contained activity while a condition evaluates to true.
Assembly: System.Activities (in System.Activities.dll)
System.Activities::Activity
System.Activities::NativeActivity
System.Activities.Statements::While
| Name | Description | |
|---|---|---|
![]() | While() | Creates a new instance of the While activity. |
![]() | While(Activity<Boolean>^) | Creates a new instance of the While activity. |
![]() | While(Expression<Func<ActivityContext^, Boolean>^>^) | Creates a new instance of the While activity. |
| Name | Description | |
|---|---|---|
![]() | Body | The Activity to execute in the While loop. |
![]() | CacheId | Gets the identifier of the cache that is unique within the scope of the workflow definition.(Inherited from Activity.) |
![]() | Condition | The Activity<TResult> to be evaluated before each iteration of the While loop. |
![]() | DisplayName | Gets or sets an optional friendly name that is used for debugging, validation, exception handling, and tracking.(Inherited from Activity.) |
![]() | Id | Gets an identifier that is unique in the scope of the workflow definition.(Inherited from Activity.) |
![]() | ImplementationVersion | Gets or sets the implementation version of the activity.(Inherited from NativeActivity.) |
![]() | Variables | The collection of Variable objects associated with the While activity. |
| Name | Description | |
|---|---|---|
![]() | Equals(Object^) | Determines whether the specified object is equal to the current object.(Inherited from Object.) |
![]() | GetHashCode() | Serves as the default hash function. (Inherited from Object.) |
![]() | GetType() | |
![]() | ShouldSerializeDisplayName() | Indicates whether the DisplayName property should be serialized.(Inherited from Activity.) |
![]() | ToString() | Returns a String that contains the Id and DisplayName of the Activity.(Inherited from Activity.) |
The following code sample demonstrates creating a While activity. This example is from the Content-Based Correlation sample.
new While { Condition = true, Body = new Receive { ServiceContractName = Constants.POContractName, OperationName = Constants.UpdatePOName, CorrelatesWith = poidHandle, // identifies that the UpdatePO operation is waiting on the PurchaseOrderId that was used to initialize this handle CorrelatesOn = new MessageQuerySet // the query that is used on an incoming message to find the requisite PurchaseOrderId specified in the correlation { // Id is the name of the incoming parameter within the PurchaseOrder { "PoId", new XPathMessageQuery("sm:body()/defns:PurchaseOrder/defns:Id", Constants.XPathMessageContext) } }, Content = ReceiveContent.Create(new OutArgument<PurchaseOrder>(po)) // creates a ReceiveMessageContent } },
Available since 4.0
Any public static ( Shared in Visual Basic) members of this type are thread safe. Any instance members are not guaranteed to be thread safe.


