C#点滴 – 内建基本类型

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,也就是值类型,内存分配在栈上。

posted on 2010-03-26 10:30  牛奶哥  阅读(293)  评论(0编辑  收藏  举报