Table of Contents

Class SafeArrayMarshaller<T>

Namespace
CsCom.Runtime
Assembly
CsCom.Runtime.dll

Marshals one-dimensional arrays as SAFEARRAYs. Multidimensional SAFEARRAYs are marshalled by SafeArrayMarshaller and ComSafeArrayMarshaller<T>.

[CustomMarshaller(typeof(CustomMarshallerAttribute.GenericPlaceholder[]), MarshalMode.Default, typeof(SafeArrayMarshaller<>))]
public static class SafeArrayMarshaller<T>

Type Parameters

T

The type of the elements.

Inheritance
SafeArrayMarshaller<T>
Inherited Members

Remarks

The variant type of the elements is derived from T: object is passed as VT_VARIANT, string as VT_BSTR, bool as VT_BOOL, DateTime as VT_DATE, enums as their underlying integer type, interfaces derived from IDispatch as VT_DISPATCH and other interfaces as VT_UNKNOWN. Use UnknownSafeArrayMarshaller for arrays of IUnknown pointers. Returned arrays are converted to zero-based arrays of T.

Methods

ConvertToManaged(nint)

Converts a SAFEARRAY to an array.

public static T[]? ConvertToManaged(nint unmanaged)

Parameters

unmanaged nint

Returns

T[]

ConvertToUnmanaged(T[]?)

Creates a SAFEARRAY from an array.

public static nint ConvertToUnmanaged(T[]? managed)

Parameters

managed T[]

Returns

nint

Free(nint)

Destroys the SAFEARRAY.

public static void Free(nint unmanaged)

Parameters

unmanaged nint