Windows apps
Collapse the table of content
Expand the table of content
Information
The topic you requested is included in another documentation set. For convenience, it's displayed below. Choose Switch to see the topic in its original location.

Marshal::IsComObject Method (Object^)

 

Indicates whether a specified object represents a COM object.

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

public:
static bool IsComObject(
	Object^ o
)

Parameters

o
Type: System::Object^

The object to check.

Return Value

Type: System::Boolean

true if the o parameter is a COM type; otherwise, false.

Exception Condition
ArgumentNullException

o is null.

IsComObject returns true if the class type of the instance is attributed with System.Runtime.InteropServices::ComImportAttribute or if it derives directly or indirectly from a class attributed with ComImportAttribute. The Tlbimp.exe (Type Library Importer) tool applies this attribute for you when it imports a type library.

Two other methods also determine whether a specified object represents a COM object, but the requirements for returning true differ from this method's requirements. Type::IsImport returns true if the class (or interface) is attributed with ComImportAttribute directly; it does not return true for derived types. RegistrationServices::TypeRepresentsComType returns true if the type is attributed with ComImportAttribute or derives from a type with the same GUID.

Universal Windows Platform
Available since 8
.NET Framework
Available since 1.1
Portable Class Library
Supported in: portable .NET platforms
Windows Phone Silverlight
Available since 8.0
Windows Phone
Available since 8.1
Return to top
Show:
© 2017 Microsoft