Export (0) Print
Expand All

While Constructor

.NET Framework 4.6 and 4.5

Creates a new instance of the While activity.

Namespace:  System.Activities.Statements
Assembly:  System.Activities (in System.Activities.dll)

public While()

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
    }
},

.NET Framework

Supported in: 4.6, 4.5, 4

.NET Framework Client Profile

Supported in: 4
Show:
© 2015 Microsoft