C++與.net資料類型對應表

來源:互聯網
上載者:User

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

相關文章

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

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.