WorkflowRuntime.Dispose Method
Definition
Important
Some information relates to prerelease product that may be substantially modified before it’s released. Microsoft makes no warranties, express or implied, with respect to the information provided here.
Releases the resources used by the WorkflowRuntime.
public:
virtual void Dispose();
public void Dispose ();
abstract member Dispose : unit -> unit
override this.Dispose : unit -> unit
Public Sub Dispose ()
Implements
Examples
The following example demonstrates how to call Dispose on a WorkflowRuntime object. In this sample, the Dispose method is called from the FormClosing event handler for the main form of the application; this ensures that the objects created by the runtime are properly cleaned up when the application shuts down. This sample is from the Speech Application Sample.
private void Form1_FormClosing(object sender, FormClosingEventArgs e)
{
this.workflowRuntime.Dispose();
}
Private Sub Form1_FormClosing(ByVal sender As Object, ByVal e As FormClosingEventArgs)
Me.workflowRuntime.Dispose()
End Sub
Remarks
To shut down the WorkflowRuntime gracefully, you should only call Dispose after you have called StopRuntime. This is because calling the Dispose method alone leaves the WorkflowRuntime in an unusable state. Dispose frees the resources used by the runtime by closing open file handles, database connections, and so on, but it does not unload workflow instances, stop services, or do any of the other actions that StopRuntime does.
Dispose should be called only when the host application must free the resources used by the WorkflowRuntime before they are automatically freed by the garbage collector. For general information about Dispose, see Cleaning Up Unmanaged Resources and Implementing a Dispose Method.
Applies to
.NET
피드백
https://aka.ms/ContentUserFeedback
출시 예정: 2024년 내내 콘텐츠에 대한 피드백 메커니즘으로 GitHub 문제를 단계적으로 폐지하고 이를 새로운 피드백 시스템으로 바꿀 예정입니다. 자세한 내용은 다음을 참조하세요.다음에 대한 사용자 의견 제출 및 보기