HwndSource.Dispose Method ()


The .NET API Reference documentation has a new home. Visit the .NET API Browser on docs.microsoft.com to see the new experience.

Releases all managed resources that are used by the HwndSource, and raises the Disposed event.

Namespace:   System.Windows.Interop
Assembly:  PresentationCore (in PresentationCore.dll)

public void Dispose()

System_CAPS_security Security Note

This method is not available in the Internet security zone.

Dispose initiates related cleanup work for the HWND. If Dispose is called through a thread that is different from the main UI thread, the cleanup work may be deferred until it can be posted to the main UI thread.

Calling Dispose explicitly from the interoperating code might be necessary for certain interoperation scenarios, because an HwndSource in some interoperation scenarios can generate several references to it across the interoperation boundaries that might prevent timely garbage collection.

.NET Framework
Available since 3.0
Return to top