C#2008整数变量类型
时间:2020-02-23 14:29:50 来源:igfitidea点击:
每个变量在C#中具有固定类型,并且整数(int)变量类型仅限于整数。
C# 有其他几个整数变量类型,如图所示:
类型 | 大小(字节) | 范围 | 示例 |
---|---|---|---|
SBYTE | 1 | -128到127 | SBYTE SB = -12; |
byte | 1 | 0到255 | byte b = 12; |
short | 2 | -32,768至32,767 | short sn = -123; |
Ushort | 2 | 0到65,535 | USHORT USN = 123; |
int | 4 | -2,147,483,648至2,147,483,647 | int n = 123; |
uint | 4 | 0至4,294,967,295 | UINT UN = 123U; |
long | 8 | -9,223,372,036,854,775,808至9,223,372,036,854,775,807 | long l = 123l; |
ulong | 8 | 0至18,446,744,073,709,551,615 | long ul = 123ul; |