C#调用DLL文件时参数对应表 Wtypes.h中的非托管类型 非托管C语言类型 托管类名 说明 HANDLE void* System.IntPtr 32位 BYTE unsigned char System.Byte 8位 SHORT short System.Int16 16位 WORD unsigned short System.UInt16 16位 INT int System.Int32 32位 UINT unsigned int System.UInt32 32位 LONG long System.Int32 32位 BOOL long System.Int32 32位 DWORD unsigned long System.UInt32 32位 ULONG unsigned long System.UInt32 32位 CHAR char System.Char 用ANSI修饰。 LPSTR char* System.String或System.StringBuilder 用ANSI修饰。 LPCSTR Const char* System.String或System.StringBuilder 用ANSI修饰。 LPWSTR wchar_t* System.String或System.StringBuilder 用Unicode修饰。 LPCWSTR Const wchar_t* System.String或System.StringBuilder 用Unicode修饰。 FLOAT Float System.Single 32位 DOUBLE Double System.Double 64位 类别 类名 说明 Visual Basic数据类型 C#数据类型 C++托管扩展数据类型 JScript数据类型 整数 Byte 8位的无符号整数。 Byte byte char Byte SByte 8位的有符号整数。 不符合CLS。 SByte 无内置类型。 sbyte signed char SByte Int16 16位的有符号整数。 Short short short short Int32 32位的有符号整数。 Integer int int - 或 - long int Int64 64位的有符号整数。 Long long __int64 long UInt16 16位的无符号整数。 不符合CLS。 UInt16 无内置类型。 ushort unsigned short UInt16 UInt32 32位的无符号整数。 不符合CLS。 UInt32 无内置类型。 uint unsigned int - 或 - unsigned long UInt32 UInt64 64位的无符号整数。 不符合CLS。 UInt64 无内置类型。 ulong unsigned __int64 UInt64 浮点 Single 单精度(32位)浮点数字。 Single float float float Double 双精度(64位)浮点数字。 Double double double double 逻辑 Boolean 布尔值(真或假)。 Boolean bool bool bool 其他 Char Unicode(16位)字符。 Char char wchar_t char Decimal 96位十进制值。 Decimal decimal Decimal Decimal IntPtr 大小取决于基础平台(32位平台上为32位值,64位平台上为64位值)的有符号整数。 IntPtr 无内置类型。 IntPtr 无内置类型。 IntPtr 无内置类型。 IntPtr UIntPtr 大小取决于基础平台的无符号整数(32位平台上为32位值,64位平台上为64位值)。 不符合CLS。 UIntPtr 无内置类型。 UIntPtr 无内置类型。 UIntPtr 无内置类型。 UIntPtr 类对象 Object 对象层次结构的根。 Object object Object* Object String Unicode字符的不变的定长串。 String string String* String