System.Runtime.InteropServices.Marshalling Namespace

Contains support types for source-generated interop, such as MarshalUsingAttribute.

Classes

AnsiStringMarshaller

Marshaller for ANSI strings.

ArrayMarshaller<T,TUnmanagedElement>

Represents a marshaller for arrays.

BStrStringMarshaller

Marshaller for BSTR strings.

ComExposedClassAttribute<T>

Indicates that a type's instances should be exposed to COM.

ComInterfaceMarshaller<T>

Marshals a COM interface using a StrategyBasedComWrappers instance.

ComObject

Base class for all COM source-generated runtime callable wrappers (RCWs).

ComVariantMarshaller

Marshals an Object to an ComVariant.

ContiguousCollectionMarshallerAttribute

Specifies that this marshaller entry-point type is a contiguous collection marshaller.

CustomMarshallerAttribute

Indicates an entry point type for defining a marshaller.

ExceptionAsDefaultMarshaller<T>

Converts the exception to the default value of the specified unmanaged type.

ExceptionAsHResultMarshaller<T>

Marshals an exception object to the value of its HResult converted to T.

ExceptionAsNaNMarshaller<T>

Converts all exceptions to NaN.

ExceptionAsVoidMarshaller

Represents a marshaller that swallows exceptions.

GeneratedComClassAttribute

Specifies that the attributed type will be exposed to COM through source-generated COM and that the source generator should generate code for it.

GeneratedComInterfaceAttribute

Specifies that the attributed type is a COM interface and that the source generator should generate code for it.

IUnknownDerivedAttribute<T,TImpl>

Indicates that an interface is a managed representation of an IUnknown-derived interface.

MarshalUsingAttribute

Attribute used to provide a custom marshaller type or size information for marshalling.

NativeMarshallingAttribute

Attribute used to provide a default custom marshaller type for a given managed type.

PointerArrayMarshaller<T,TUnmanagedElement>

Represents a marshaller for an array of pointers.

ReadOnlySpanMarshaller<T,TUnmanagedElement>.UnmanagedToManagedOut

Supports marshalling from managed into unmanaged in a call from unmanaged code to managed code.

ReadOnlySpanMarshaller<T,TUnmanagedElement>

Supports marshalling a ReadOnlySpan<T> from managed value to a contiguous native array of the unmanaged values of the elements.

SafeHandleMarshaller<T>

Marshals SafeHandle-derived types following the lifetime rules for SafeHandle objects.

SpanMarshaller<T,TUnmanagedElement>

Supports marshalling a Span<T> from managed value to a contiguous native array of the unmanaged values of the elements.

StrategyBasedComWrappers

A ComWrappers-based type that uses customizable strategy objects to implement COM object wrappers and managed object wrappers exposed to COM.

UniqueComInterfaceMarshaller<T>

Marshals COM interfaces using a StrategyBasedComWrappers instance that only creates unique native object wrappers (RCWs).

Utf16StringMarshaller

A marshaller for UTF-16 strings.

Utf8StringMarshaller

A marshaller for UTF-8 strings.

Structs

AnsiStringMarshaller.ManagedToUnmanagedIn

Custom marshaller to marshal a managed string as a ANSI unmanaged string.

ArrayMarshaller<T,TUnmanagedElement>.ManagedToUnmanagedIn

Marshaller for marshalling a array from managed to unmanaged.

BStrStringMarshaller.ManagedToUnmanagedIn

Custom marshaller to marshal a managed string as a ANSI unmanaged string.

ComVariant

A type that represents an OLE VARIANT in managed code.

ComVariantMarshaller.RefPropagate

Marshals a Object to an ComVariant, propagating the value of the Object back to the variant's existing data storage if the variant has VT_BYREF type.

CustomMarshallerAttribute.GenericPlaceholder

Placeholder type for a generic parameter.

IIUnknownCacheStrategy.TableInfo

Contains information about a COM interface and its virtual method table.

PointerArrayMarshaller<T,TUnmanagedElement>.ManagedToUnmanagedIn

Represents a marshaller for marshalling an array from managed to unmanaged.

ReadOnlySpanMarshaller<T,TUnmanagedElement>.ManagedToUnmanagedIn

Supports marshalling from managed into unmanaged in a call from managed code to unmanaged code.

ReadOnlySpanMarshaller<T,TUnmanagedElement>.ManagedToUnmanagedOut

Supports marshalling from unmanaged to managed in a call from managed code to unmanaged code. For example, return values and out parameters in P/Invoke methods.

SafeHandleMarshaller<T>.ManagedToUnmanagedIn

Marshals a SafeHandle as its underlying handle value as an in parameter or a parameter passed by value in managed-to-unmanaged scenarios like P/Invokes.

SafeHandleMarshaller<T>.ManagedToUnmanagedOut

Marshals a SafeHandle as its underlying handle value as an out parameter in managed-to-unmanaged scenarios like P/Invokes.

SafeHandleMarshaller<T>.ManagedToUnmanagedRef

Marshals a SafeHandle as its underlying handle value as a ref parameter in managed-to-unmanaged scenarios like P/Invokes.

SpanMarshaller<T,TUnmanagedElement>.ManagedToUnmanagedIn

Supports marshalling from managed into unmanaged in a call from managed code to unmanaged code.

Utf8StringMarshaller.ManagedToUnmanagedIn

Custom marshaller to marshal a managed string as a UTF-8 unmanaged string.

VirtualMethodTableInfo

Provides information about a virtual method table and the unmanaged instance pointer.

Interfaces

IComExposedClass

Defines type-level information for managed class types exposed to COM.

IComExposedDetails

Defines details about a managed class type exposed to COM.

IIUnknownCacheStrategy

Defines an unmanaged virtual method table look up strategy.

IIUnknownDerivedDetails

Provides details for the IUnknown-derived interface.

IIUnknownInterfaceDetailsStrategy

Defines a strategy for acquiring interface details.

IIUnknownInterfaceType

Defines type-level information for an IUnknown-derived interface.

IIUnknownStrategy

Defines the IUnknown interaction strategy.

IUnmanagedVirtualMethodTableProvider

Provides information about a virtual method table for a managed interface to enable invoking methods in the virtual method table.

Enums

ComInterfaceOptions

Options for how to generate COM interface interop with the COM interop source generator.

MarshalMode

Represents the different marshalling modes.