Marshal.GetComObjectData(Object, Object) Method

Definition

Retrieves data that is referenced by the specified key from the specified COM object.

public:
 static System::Object ^ GetComObjectData(System::Object ^ obj, System::Object ^ key);
[System.Runtime.Versioning.SupportedOSPlatform("windows")]
public static object? GetComObjectData (object obj, object key);
public static object GetComObjectData (object obj, object key);
public static object? GetComObjectData (object obj, object key);
[System.Security.SecurityCritical]
public static object GetComObjectData (object obj, object key);
[<System.Runtime.Versioning.SupportedOSPlatform("windows")>]
static member GetComObjectData : obj * obj -> obj
static member GetComObjectData : obj * obj -> obj
[<System.Security.SecurityCritical>]
static member GetComObjectData : obj * obj -> obj
Public Shared Function GetComObjectData (obj As Object, key As Object) As Object

Parameters

obj
Object

The COM object that contains the data that you want.

key
Object

The key in the internal hash table of obj to retrieve the data from.

Returns

The data represented by the key parameter in the internal hash table of the obj parameter.

Attributes

Exceptions

obj is null.

-or-

key is null.

obj is not a COM object.

-or-

obj is a Windows Runtime object.

Remarks

All COM objects wrapped in a Runtime Callable Wrapper have an associated hash table, which GetComObjectData retrieves. Marshal.SetComObjectData adds data to the hash table. You should never have to call either method from your code.

Applies to

See also