C#點滴 – 內建基本類型

來源:互聯網
上載者:User

C#的System命名 空間定義了可用於局部變數、成員變數,參數和傳回值的基本類型。在C#中有相應的關鍵字相對應。

關鍵字

系統類別型

範圍

描述

bool

System.Boolean

true/false

表示邏輯真或者假

sbyte

System.SByte

-128~127

帶符號8位元

byte

System.Byte

0~256

無符號的8位元

short

System.Int16

-32768~32767

帶符號16位元

ushort

System.UInt16

0~65535

無符號16位元

int

System.Int32

-2147483648~

2147483647

帶符號32位元

uint

System.UInt32

0~4294967295

無符號32位元

long

System.Int64

-9223372036854775808~

9223372036854775807

帶符號64位元

ulong

System.UInt64

0~18446744073709551615

無符號64位元

char

System.Char

 

16位unicode字元

float

System.Single

 

32位單精確度浮點數

double

System.Double

 

64位雙精確度浮點數

decimal

Decimal

 

128帶符號數

string

System.String

 

表示一個unicode字元集合

object

System.Object

 

所有類型基類

 

基本類型除了string,object外,大多是Struct,也就是實值型別,記憶體配置在棧上。

聯繫我們

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