The following Element Type | With the following MarshalAs Attribute | Is converted to the following Type library type | System Type | Built-in Language Type | ||
---|---|---|---|---|---|---|
VB | Mgd C++ | C# | ||||
Boolean | VARIANT_BOOL | System.Boolean | boolean | bool | bool | |
I1 | char | System.SByte | n/a | byte | byte | |
I2 | short | System.Int16 | short | short | short | |
I4 | long | System.Int32 | integer | long | int | |
I8 | hyper | System.Int64 | long | __int64 | long | |
UI1 | unsigned char | System.Byte | byte | byte | byte | |
UI2, CHAR | unsigned short | System.UInt16 System.Char |
n/a | unsigned short, | ushort, char | |
CHAR | Char | char | System.Char | n/a | char | char |
UI2 | Error | SCODE | System.UInt16 | n/a | unsigned short | ushort |
UI4 | unsigned long, unsigned int | System.UInt32 | N/A | unsigned long | uint | |
UI4 | Error | SCODE | n/a | n/a | n/a | |
UI8 | unsigned hyper | System.UInt64 | N/A | unsigned __int64 | ulong | |
R4 | single | System.Single | single | float | float | |
R8 | double | System.Double | double | double | double | |
STRING | BStr | BSTR | System.String | string | n/a | string |
STRING | LPStr | LPSTR | System.String | string | n/a | string |
STRING | LPWStr | LPWSTR | System.String | string | n/a | string |
OBJECT | VARIANT | System.Object | ||||
VALUETYPE <System.Decimal> |
DECIMAL | System.Decimal | ||||
VALUETYPE <System.DateTime> |
DATE | System.DateTime | ||||
VALUETYPE <System.Guid> |
GUID | System.Guid | ||||
VALUETYPE <System.Currency> |
CURRENCY | System.Currency | ||||
OBJECT | Interface | IUnknown * | System.Object | |||
OBJECT | Interface | IDispatch * | System.Object | |||
SZARRAY(type) | SAFEARRAY | SAFEARRAY(type) | type[] | |||
BaseType | typedef BaseType MyType | |||||
VALUETYPE <MyStruct> |
MyStruct | |||||
VALUETYPE <MyEnum> |
MyEnum | |||||
CLASS <MyInterface> | Interface | MyInterface | ||||
CLASS <_Class> |
Interface | MyCoClass | ||||
Reference Types | ||||||
ByRef Boolean | VARIANT_BOOL * | System.Boolean | boolean | bool | bool | |
ByRef I1 | char * | System.SByte | boolean | byte | sbyte | |
ByRef I2 | short * | System.Int16 | short | short | short | |
ByRef I4 | long * | System.Int32 | integer | long | int | |
ByRef I8 | hyper * | System.Int64 | long | __int64 | long | |
ByRef UI1 | unsigned char * | System.Byte | byte | byte | byte | |
ByRef UI2, ByRef CHAR |
unsigned short * | System.UInt16 | N/A | unsigned short | ushort | |
ByRef CHAR | Char | char * | System.Char | N/A | char | char |
ByRef UI4 | unsigned long * | System.UInt32 | N/A | unsigned long | uint | |
ByRef I4 | Error | HRESULT * | System.UInt32 | N/A | unsigned long | uint |
ByRef R4 | single * | System.Single | single | float | float | |
ByRef R8 | double * | System.Double | double | double | double | |
ByRef STRING | BStr | BSTR * | System.String | string | n/a | string |
ByRef STRING | LPStr | LPSTR * | System.String | string | n/a | string |
ByRef STRING | LPWStr | LPWSTR * | System.String | string | n/a | string |
ByRef OBJECT | VARIANT * | System.Object | ||||
ByRef VALUETYPE <System.Decimal> |
DECIMAL * | System.Decimal | ||||
ByRef VALUETYPE <System.DateTime> |
DATE * | System.DateTime | ||||
ByRef VALUETYPE <System.Guid> |
GUID * | System.Guid | ||||
ByRef VALUETYPE <System.Currency> |
CURRENCY * | System.Currency | ||||
ByRef OBJECT | Interface | IUnknown ** | System.Object | |||
ByRef OBJECT | Interface | IDispatch ** | System.Object | |||
ByRef SZARRAY(type) | SAFEARRAY | SAFEARRAY(type) * | type[] | |||
ByRef BaseType | typedef BaseType MyType | |||||
ByRef VALUETYPE <MyStruct> |
MyStruct * | |||||
ByRef VALUETYPE <MyEnum> |
MyEnum * | |||||
ByRef CLASS <MyInterface> | Interface | MyInterface * | ||||
ByRef CLASS <_Class> |
Interface | MyCoClass * |