Name
MarshalAs Attribute
Class
System.Runtime.InteropServices.MarshalAsAttribute
Applies to
Field, Parameter, ReturnValue
Description
Defines the correct type conversion between
managed and unmanaged
code. Unmanaged types are defined by the
UnmanagedType
enumeration, which is shown in the
following table:
UnmanagedType |
Value |
Description |
---|---|---|
|
35 |
An ANSI BSTR (a character string whose first byte indicates the string length). |
|
40 |
Dynamic type determination at runtime. |
|
2 |
4-byte Boolean ( |
|
19 |
A Unicode BSTR (a character string whose first 2 bytes indicates the string length). |
|
30 |
An array passed by value. An array that is a field in a structure must have this attribute. The SixeConst field must be set to the number of array elements, and the ArraySubType field can optionally be set to the unmanaged data type of the array. |
|
23 |
An inline fixed-length character array within a structure. The
character type is determined by the
|
|
15 |
A COM Currency data type. Used on the VB.NET and .NET Decimal data type. |
|
44 |
A custom marshaler class. The class is defined by the MarshalType or MarshelTypeRef field. Additional information can be passed to the custom marshaler by the MarshalCookie field. |
|
45 |
An |
Get VB.NET Language in a Nutshell, Second Edition now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.