Default Marshaling Behavior
Interop marshaling operates on rules that dictate how data associated with method parameters behaves as it passes between managed and unmanaged memory. These built-in rules control such marshaling activities as data type transformations, whether a callee can change data passed to it and return those changes to the caller, and under which circumstances the marshaler provides performance optimizations.
This section identifies the default behavioral characteristics of the interop marshaling service. It presents detailed information on marshaling arrays, Boolean types, char types, delegates, classes, objects, strings, and structures.
Note
Marshaling of generic types is not supported. For more information see, Interoperating Using Generic Types.
In This Section
Memory Management with the Interop Marshaler
Describes how the interop marshaler frees memory allocated by unmanaged code.Directional Attributes
Describes the InAttribute and OutAttribute attributes, and when to use them.Blittable and Non-Blittable Types
Describes data types that require conversion when marshaled to unmanaged memory.Copying and Pinning
Describes how copying and pinning affect data marshaling.Default Marshaling for Arrays
Describes marshaling for arrays.Default Marshaling for Boolean Types
Describes marshaling for Boolean types.Default Marshaling for Characters
Describes marshaling for charactersDefault Marshaling for Classes
Describes marshaling for classes.Default Marshaling for Delegates
Describes marshaling for delegates.Default Marshaling for Objects
Describes marshaling for objects.Default Marshaling for Strings
Describes marshaling for strings.Default Marshaling for Value Types
Describes marshaling for value types.
Related Sections
Marshaling Data with Platform Invoke
Describes how to declare method parameters and pass arguments to functions exported by unmanaged libraries.Marshaling Data with COM Interop
Describes how to customize COM wrappers to alter marshaling behavior.