While 建構函式
定義
重要
部分資訊涉及發行前產品,在發行之前可能會有大幅修改。 Microsoft 對此處提供的資訊,不做任何明確或隱含的瑕疵擔保。
建立 While 活動的新執行個體。
多載
While() |
建立 While 活動的新執行個體。 |
While(Activity<Boolean>) |
建立 While 活動的新執行個體。 |
While(Expression<Func<ActivityContext,Boolean>>) |
建立 While 活動的新執行個體。 |
範例
下列程式碼範例將示範如何建立 While 活動。
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
}
},
While()
建立 While 活動的新執行個體。
public:
While();
public While ();
Public Sub New ()
範例
下列程式碼範例將示範如何建立 While 活動。
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
}
},
適用於
While(Activity<Boolean>)
建立 While 活動的新執行個體。
public:
While(System::Activities::Activity<bool> ^ condition);
public While (System.Activities.Activity<bool> condition);
new System.Activities.Statements.While : System.Activities.Activity<bool> -> System.Activities.Statements.While
Public Sub New (condition As Activity(Of Boolean))
參數
適用於
While(Expression<Func<ActivityContext,Boolean>>)
建立 While 活動的新執行個體。
public:
While(System::Linq::Expressions::Expression<Func<System::Activities::ActivityContext ^, bool> ^> ^ condition);
public While (System.Linq.Expressions.Expression<Func<System.Activities.ActivityContext,bool>> condition);
new System.Activities.Statements.While : System.Linq.Expressions.Expression<Func<System.Activities.ActivityContext, bool>> -> System.Activities.Statements.While
Public Sub New (condition As Expression(Of Func(Of ActivityContext, Boolean)))
參數
- condition
- Expression<Func<ActivityContext,Boolean>>
活動重複的條件。