Created
July 23, 2012 05:42
-
-
Save sandrinodimattia/3162118 to your computer and use it in GitHub Desktop.
COM cleanup
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/// <summary> | |
/// Release a COM object so that it can be cleaned up. | |
/// </summary> | |
/// <param name="comObj"></param> | |
protected void ReleaseCom(dynamic comObj) | |
{ | |
Marshal.ReleaseComObject(comObj); | |
} | |
/// <summary> | |
/// Clean up all released COM objects. | |
/// </summary> | |
protected void CleanAllReleased() | |
{ | |
GC.Collect(); | |
GC.WaitForPendingFinalizers(); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment