C# 中整数的最大可能值是多少?

csharpprogrammingserver side programming更新于 2025/10/15 13:52:17

整数的最大可能值为 2,147,483,647。

以下是 C# 中最大值和最小值对应的数据类型。

类型表示范围默认值
bool布尔值True 或 FalseFalse
byte8 位无符号整数0 到255
char16 位 Unicode 字符U +0000 到 U +ffff'\0'
decimal128 位精确十进制值,有效数字 28-29(-7.9 x 1028 到 7.9 x 1028) / 100 到 280.0M
double64 位双精度浮点类型(+/-)5.0 x 10-324 到 (+/-)1.7 x 103080.0D
float32 位单精度浮点类型-3.4 x 1038 至 + 3.4 x 10380.0F
int32 位有符号整数类型-2,147,483,648 至 2,147,483,6470
long64 位有符号整数类型-9,223,372,036,854,775,808 至9,223,372,036,854,775,8070L
sbyte8 位有符号整数类型-128 到 1270
short16 位有符号整数类型-32,768 到 32,7670
uint32 位无符号整数类型0 到 4,294,967,2950
ulong64 位无符号整数类型0 到18,446,744,073,709,551,6150
ushort16 位无符号整数类型0 到 65,5350

相关文章