Marshal.FinalReleaseComObject Method

Note: This method is new in the .NET Framework version 2.0.

Releases all references to a runtime callable wrapper (RCW) by setting the reference count of the supplied RCW to 0.

Namespace: System.Runtime.InteropServices
Assembly: mscorlib (in mscorlib.dll)

public static int FinalReleaseComObject (
	Object o
public static int FinalReleaseComObject (
	Object o
public static function FinalReleaseComObject (
	o : Object
) : int



The RCW to be released.

Return Value

The new value of the reference count of the RCW associated with the oparameter, which is zero if the release is successful.

Exception typeCondition


o is not a valid COM object.


o is a null reference (Nothing in Visual Basic).

The FinalReleaseComObject method releases the managed reference to a COM object. Calling this method is equivalent to calling the ReleaseComObject method in a loop until it returns 0.

Windows 98, Windows 2000 SP4, Windows Millennium Edition, Windows Server 2003, Windows XP Media Center Edition, Windows XP Professional x64 Edition, Windows XP SP2, Windows XP Starter Edition

The .NET Framework does not support all versions of every platform. For a list of the supported versions, see System Requirements.

.NET Framework

Supported in: 2.0

.NET Compact Framework

Supported in: 2.0

Community Additions