c和c#託管與Unmanaged 程式碼中變數對應

來源:互聯網
上載者:User

  下表列出了在 Win32 API(在 Wtypes.h 中列出)和 C 樣式函數中使用的資料類型。許多非託管庫包含將這些資料類型作為參數傳遞並傳回值的函數。

第三列列出了在Managed 程式碼中使用的相應的 .NET Framework 內建實值型別或類。某些情況下,您可以用大小相同的類型替換此表中列出的類型。 

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 位元

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在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.