WorkflowRuntime::Dispose Method ()

 

Releases the resources used by the WorkflowRuntime.

Namespace:   System.Workflow.Runtime
Assembly:  System.Workflow.Runtime (in System.Workflow.Runtime.dll)

public:
virtual void Dispose() sealed

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.

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.

No code example is currently available or this language may not be supported.

.NET Framework
Available since 3.0
Return to top
Show: