.NET: How to determine if an object is a COM object?

How to determine if an object is a COM object? I need to call Marshal.FinalReleaseComObject for all COM objects in an array of type Object.

+7
com
source share
3 answers
+8
source share
typeof(myObject).IsCOMObject 

or

 instanceOfMyObject.GetType().IsCOMObject 
+5
source share

You can call GetType () and check the IsCOMObject property

+2
source share

All Articles