MinValue / MaxValue for Numeric Types

You can access minimum and maximum values for the various built-in numeric types from your code by using theMinValue and MaxValue properties of each type.  All of the built-in numeric types have MinValue and MaxValueproperties.


1
2
3
4
5
6
7
8
byte bMin = byte.MinValue;    // 0
byte bMax = byte.MaxValue;    // 255
 
int nMin = int.MinValue;      // -2147483648
int nMax = Int32.MaxValue;    // 2147483647
 
char cMin = char.MinValue;    // 0x0000
char cMax = char.MaxValue;    // 0xffff