MarshalMode Enum
Definition
Important
Some information relates to prerelease product that may be substantially modified before it’s released. Microsoft makes no warranties, express or implied, with respect to the information provided here.
Represents the different marshalling modes used by CustomMarshallerAttribute to indicate when a marshaller applies.
public enum class MarshalMode
public enum MarshalMode
type MarshalMode =
Public Enum MarshalMode
- Inheritance
Fields
| Name | Value | Description |
|---|---|---|
| Default | 0 | All modes. A marshaller specified with this mode will be used if there's no specific marshaller for a given usage mode. |
| ManagedToUnmanagedIn | 1 | By-value and |
| ManagedToUnmanagedRef | 2 |
|
| ManagedToUnmanagedOut | 3 |
|
| UnmanagedToManagedIn | 4 | By-value and |
| UnmanagedToManagedRef | 5 |
|
| UnmanagedToManagedOut | 6 |
|
| ElementIn | 7 | Elements of arrays passed with |
| ElementRef | 8 | Elements of arrays passed with |
| ElementOut | 9 | Elements of arrays passed with |
Remarks
Each member name follows the pattern {CallDirection}{DataFlow}:
- Call direction (
ManagedToUnmanagedorUnmanagedToManaged) indicates which side initiates the call.ManagedToUnmanagedapplies to P/Invoke calls.UnmanagedToManagedapplies to Reverse P/Invoke or COM scenarios where native code calls into managed code. - Data flow (
In,Out, orRef) indicates how data moves relative to the call.Inmeans data flows from caller to callee.Outmeans data flows from callee to caller, which includes bothoutparameters and return values.Refmeans data flows in both directions.
For example, ManagedToUnmanagedOut applies when managed code calls unmanaged code (P/Invoke) and data flows back to the caller — this covers out parameters and return values. The marshaller for this mode converts from the unmanaged type to the managed type.