C # and C + + type comparison table

Source: Internet
Author: User
Tags comparison table

C + + C #
=====================================
WORD ushort
DWORD UINT
UCHAR Int/byte can be replaced in most cases using int, and if strict alignment is required, it should be used Bytebyte
uchar* string/intptr
unsigned char* [MarshalAs (UnmanagedType.LPArray)]byte[]/? (INTPTR)
char* string
LPCTSTR string
LPTSTR [MarshalAs (UNMANAGEDTYPE.LPTSTR)] string
Long int
ULONG UINT
Handle INTPTR
HWND INTPTR
void* INTPTR
int int
int* ref int
*int INTPTR
unsigned int UINT
COLORREF UINT

API and C # data type correspondence table API data type description C # type API datatype type description C # type WORD 16-bit unsigned integer ushort char char long 32-bit unsigned integer int dwordlong 64-bit long integer Long DWORD 32-bit unsigned integer UINT HDC device descriptor table handle int HANDLE handle, 32-bit integer int hgdiobj GDI object handle int UINT 32-bit unsigned integer UINT hinstance instance handle int BOO L 32-bit boolean integer bool HWM window handle int LPSTR 32-bit pointer to character string Hparam 32-bit message parameter int LPCSTR 32-bit pointer to constant character string LPARAM 32-bit message parameter int BYTE Bytes Byte WPARAM 32-bit message parameter int

Bool=system.int32
Boolean=system.int32
Byte=system.uint16
Char=system.int16
Colorref=system.uint32
Dword=system.uint32
Dword32=system.uint32
Dword64=system.uint64
Float=system.float
Haccel=system.intptr
Handle=system.intptr
Hbitmap=system.intptr
Hbrush=system.intptr
Hconv=system.intptr
Hconvlist=system.intptr
Hcursor=system.intptr
Hdc=system.intptr
Hddedata=system.intptr
Hdesk=system.intptr
Hdrop=system.intptr
Hdwp=system.intptr
Henhmetafile=system.intptr
Hfile=system.intptr
Hfont=system.intptr
Hgdiobj=system.intptr
Hglobal=system.intptr
Hhook=system.intptr
Hicon=system.intptr
Himagelist=system.intptr
Himc=system.intptr
Hinstance=system.intptr
Hkey=system.intptr
Hlocal=system.intptr
Hmenu=system.intptr
Hmetafile=system.intptr
Hmodule=system.intptr
Hmonitor=system.intptr
Hpalette=system.intptr
Hpen=system.intptr
Hrgn=system.intptr
Hrsrc=system.intptr
Hsz=system.intptr
Hwinsta=system.intptr
Hwnd=system.intptr
Int=system.int32
Int32=system.int32
Int64=system.int64
Long=system.int32
Long32=system.int32
Long64=system.int64
Longlong=system.int64
Lparam=system.intptr
Lpbool=system.int16[]
Lpbyte=system.uint16[]
Lpcolorref=system.uint32[]
Lpcstr=system.string
Lpctstr=system.string
Lpcvoid=system.uint32
Lpcwstr=system.string
Lpdword=system.uint32[]
Lphandle=system.uint32
Lpint=system.int32[]
Lplong=system.int32[]
Lpstr=system.string
Lptstr=system.string
Lpvoid=system.uint32
Lpword=system.int32[]
Lpwstr=system.string
Lresult=system.intptr
Pbool=system.int16[]
Pboolean=system.int16[]
Pbyte=system.uint16[]
Pchar=system.char[]
Pcstr=system.string
Pctstr=system.string
Pcwch=system.uint32
Pcwstr=system.uint32
Pdword=system.int32[]
Pfloat=system.float[]
Phandle=system.uint32
Phkey=system.uint32
Pint=system.int32[]
Plcid=system.uint32
Plong=system.int32[]
Pluid=system.uint32
Pshort=system.int16[]
Pstr=system.string
Ptbyte=system.char[]
Ptchar=system.char[]
Ptstr=system.string
Puchar=system.char[]
Puint=system.uint32[]
Pulong=system.uint32[]
Pushort=system.uint16[]
Pvoid=system.uint32
Pwchar=system.char[]
Pword=system.int16[]
Pwstr=system.string
Regsam=system.uint32
Sc_handle=system.intptr
Sc_lock=system.intptr
Short=system.int16
Size_t=system.uint32
Ssize_=system.uint32
Tbyte=system.char
Tchar=system.char
Uchar=system.byte
Uint=system.uint32
Uint32=system.uint32
Uint64=system.uint64
Ulong=system.uint32
Ulong32=system.uint32
Ulong64=system.uint64
Ulonglong=system.uint64
Ushort=system.uint16
Word=system.uint16
Wparam=system.intptr

<---------supplement----------->

Non-managed type unmanaged C language type managed class name in Wtypes.h description
HANDLE void* System.IntPtr 32-bit
BYTE unsigned char System.Byte 8-bit
Short short system.int16 16-bit
WORD unsigned short system.uint16 16-bit
int int System.Int32 32 bit
UINT unsigned int System.UInt32 32-bit
Long Long System.Int32 32-bit
BOOL Long System.Int32 32 bit
DWORD unsigned long system.uint32 32 bit
ULONG unsigned long system.uint32 32 bit
Char Char System.Char is decorated with ANSI.
LPSTR char* System.String or system.stringbuilder are decorated with ANSI.
LPCSTR Const char* System.String or system.stringbuilder is decorated with ANSI.
LPWSTR wchar_t* System.String or system.stringbuilder are decorated with Unicode.
LPCWSTR Const wchar_t* System.String or system.stringbuilder is decorated with Unicode.
float float System.Single 32-bit
Double Double System.Double 64-bit

C # and C + + type comparison table

Related Article

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.