Marshal.FinalReleaseComObject Method

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 Shared Function FinalReleaseComObject ( _
	o As Object _
) As Integer
Dim o As Object
Dim returnValue As Integer

returnValue = Marshal.FinalReleaseComObject(o)
public static int FinalReleaseComObject (
	Object o
public static function FinalReleaseComObject (
	o : Object
) : int
Not applicable.



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 Server 2000 SP4, Windows CE, Windows Millennium Edition, Windows Mobile for Pocket PC, Windows Mobile for Smartphone, Windows Server 2003, Windows XP Media Center Edition, Windows XP Professional x64 Edition, Windows XP SP2, Windows XP Starter Edition

The Microsoft .NET Framework 3.0 is supported on Windows Vista, Microsoft Windows XP SP2, and Windows Server 2003 SP1.

.NET Framework

Supported in: 3.0, 2.0

.NET Compact Framework

Supported in: 2.0

Community Additions