AsyncCodeActivity.EndExecute(AsyncCodeActivityContext, IAsyncResult) 方法

定义

当在派生类中实现并使用指定的执行环境信息时,通知工作流运行时关联异步活动操作已完成。

protected:
 abstract void EndExecute(System::Activities::AsyncCodeActivityContext ^ context, IAsyncResult ^ result);
protected abstract void EndExecute (System.Activities.AsyncCodeActivityContext context, IAsyncResult result);
abstract member EndExecute : System.Activities.AsyncCodeActivityContext * IAsyncResult -> unit
Protected MustOverride Sub EndExecute (context As AsyncCodeActivityContext, result As IAsyncResult)

参数

context
AsyncCodeActivityContext

定义 AsyncCodeActivity 的执行环境的信息。

result
IAsyncResult

执行结束时返回异步活动状态的已实现 IAsyncResult

示例

下面的示例显示如何在自定义活动中重写 EndExecute 方法。

    protected override void EndExecute(AsyncCodeActivityContext context, IAsyncResult result)
    {
        FileStream file = (FileStream)context.UserState;

        try
        {
            file.EndWrite(result);
            file.Flush();
        }
        finally
        {
            file.Close();
        }
    }
}

适用于