共用方式為


WorkflowApplicationCompletedEventArgs.Outputs 屬性

定義

取得包含 OutArgument 之工作流程執行個體根活動的值,以引數名稱作為索引鍵。

public:
 property System::Collections::Generic::IDictionary<System::String ^, System::Object ^> ^ Outputs { System::Collections::Generic::IDictionary<System::String ^, System::Object ^> ^ get(); };
public System.Collections.Generic.IDictionary<string,object> Outputs { get; }
member this.Outputs : System.Collections.Generic.IDictionary<string, obj>
Public ReadOnly Property Outputs As IDictionary(Of String, Object)

屬性值

字典,其中包含以自變數名稱為索引的工作流程實例根活動的 值 OutArgument

範例

下列程式碼範例會檢查傳遞給 WorkflowApplicationCompletedEventArgs 執行個體之 Completed 處理常式的 WorkflowApplication,並且顯示工作流程如何完成的相關資訊。

wfApp.Completed = delegate(WorkflowApplicationCompletedEventArgs e)
{
    if (e.CompletionState == ActivityInstanceState.Faulted)
    {
        Console.WriteLine("Workflow {0} Terminated.", e.InstanceId);
        Console.WriteLine("Exception: {0}\n{1}",
            e.TerminationException.GetType().FullName,
            e.TerminationException.Message);
    }
    else if (e.CompletionState == ActivityInstanceState.Canceled)
    {
        Console.WriteLine("Workflow {0} Canceled.", e.InstanceId);
    }
    else
    {
        Console.WriteLine("Workflow {0} Completed.", e.InstanceId);

        // Retrieve the outputs of the workflow.
        foreach (var kvp in e.Outputs)
        {
            Console.WriteLine("Name: {0} - Value {1}",
                kvp.Key, kvp.Value);
        }

        // Outputs can be directly accessed by argument name.
        Console.WriteLine("The winner is {0}.", e.Outputs["Winner"]);
    }
};

適用於