c++与c#类型对照表

C/C++

C#

Int,Long

int

Int *

Ref int

LPCSTR, const char *

[MarshalAs(UnmanagedType.LPSTR)]

string

LPCTSTR, const TCHAR *

[MarshalAs(UnmanagedType.LPTSTR)]

string

LPSTR, char *

[MarshalAs(UnmanagedType.LPSTR)]

stringBuilder

LPTSTR, TCHAR *

[MarshalAs(UnmanagedType.LPTSTR)]

stringBuilder

Byte [n] str

[MarshalAs(UnmanagedType.LPArray)]

byte[]str

WORD

uInt16

Byte,unsigned char

byte

Short

Int16

float

single

double

double

DWORD,unsigned long,Ulong

[MarshalAs(UnmanagedType.U4)]

UInt32

bool

bool

HANDLE,LPDWORD,LPVOID,void*

IntPtr

NULLpointer

IntPtr.Zero

 

你可能感兴趣的:(C++)