.NET Compact Framework Blittable Types
[This documentation is for preview only, and is subject to change in later releases. Blank topics are included as placeholders.]
A type is considered blittable if it has a common representation in both managed and unmanaged memory, thereby requiring no special handling by the marshaler to convert to unmanaged or managed code.
Blittable Types in Both Frameworks
The following types, defined in the System namespace, are blittable types in both the full .NET Framework and .NET Compact Framework:
The following complex types are also blittable:
One-dimensional arrays of blittable types.
Formatted value types that contain only blittable types. Because all structures and classes always have sequential layout in the .NET Compact Framework, the managed value type has the same memory layout as the unmanaged structure.
Blittable Types Only in the .NET Compact Framework
The .NET Compact Framework provides the following blittable types because of their implementation in the common language runtime:
-
This is a 1-byte integer value. In the full .NET Framework, the default marshaling for a Boolean corresponds to the MarshalAsAttribute(UnmanagedType.Bool) attribute, which uses a 4-byte integer value.
-
This is always a Unicode char (2 bytes), whereas the full .NET Framework may treat this either as a Unicode char or an ANSI char depending on the MarshalAsAttribute attribute or the DllImportAttribute.CharSet field.
-
This is always treated as a Unicode array, whereas the .NET Framework may treat this as a Unicode or ANSI array or a BSTR depending on the MarshalAsAttribute attribute or the DllImportAttribute.CharSet field.