Contents

变量内存占用和取值范围

Contents
  • 基础数据类型取值范围
  • string不属于基础数据类型
关键字占用字节数取值范围
sbyte1-128~127
byte10~255
short2-32768~32767
ushort20~65535
int4-2147483648~2147483647
uint40~4292967295
long8-9223372036854775808~9223372036854775808
ulong80~18446744073709551615
char20~65535
float4存储7到8位有效数字 根据编译器不同 有效数字可能不一样
double8存储15~17位有效数字
bool(true,false)
decimal16存储27~28位有效数字