C/C++ 与 C# 常用数据类型对比

C/C++ 与 C# 常用数据类型对比

在C# 调用C/C++ DLL 或C/C++ 调用C#回调函数时,经常涉及到一些常用的数据类型。有些数据类型,在两者中的数据长度不一致,下面将对一些常用的数据类型进行下对比。

非托管C语言类型 C# 类型 说明
char System.Char ANSI 修饰
unsigned char System.Byte 8位
short System.Int16 16位
unsigned short System.UInt16 16位
int System.Int32 32位
unsigned int System.UInt32 32位
long System.Int32 32位
unsigned long System.UInt32 32位
float System.Single 32位
double System.Double 32位

char与字符串

关于char在实际开发中,如果表示字符,在C#则用System.Char类型;如果表示有符号整型

你可能感兴趣的:(C,Sharp,c语言,c++,c#,windows,visualstudio,开发语言)