C + + and C # data type conversions (common)

Source: Internet
Author: User

C++ C#
HANDLE (void *) System.IntPtr
Byte (unsigned char) System.Byte
Short (short) System.Int16
WORD (unsigned short) System.Int16
int (int) System.Int16 System.Int32
UINT (unsigned int) System.Int16 System.Int32
Long (long) System.Int32
ULONG (unsigned long) System.UInt32
char (char) System.Char
BOOL bool
LPSTR System.String
LPWStr System.String
LPCSTR System.String
Lpcwstr System.String
Structural body public struct struct {}
struct * * Variable name Out variable name
struct & variable Name Ref variable Name

C++ C#
UCHAR Int
UCHAR Byte
uchar* String
uchar* IntPtr
Handle IntPtr
Colorref UInt
unsigned char Byte
unsigned char* Ref byte

[MarshalAs (UnmanagedType.LPArray)] byte[]

[MarshalAs (UnmanagedType.LPArray)] IntPtr

unsigned char& Ref byte
unsigned char variable name BYTE variable name
unsigned short variable name Short variable name
unsigned int variable name UINT variable Name
unsigned long variable name ULONG variable Name
unsigned char variable name BYTE variable name

C++ C#
char array name [array size]

[MarshalAs (unmanagedtype.byvaltstr,sizeconst= array size)]

public string array Name

char* String
Cons char* String
Char[] String
Incoming parameters
Char & StringBuilder
Outgoing parameters
char * Ref string
Handle IntPtr
hwnd IntPtr
void* IntPtr

C + + and C # data type conversions (common)

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.