Home / Software / Tips and Tricks / Max and Min int Constants

Max and Min int Constants

Updated:  05/12/2010 08:05 AM
Author:  Shiju Mathews

Status:    Resolved.


We need minimum and maximum values in your program, such as by using int.MaxValue and int.Min. Every integer or typed number in the C# language has a specific max value, but that number is different for int, uint, short, and ushort.

FieldValueReference
short.MaxValue 32767Reference
short.MinValue-32768 Reference
ushort.MaxValue 65535 Reference
ushort.MinValue 0Reference
int.MaxValue 2,147,483,647Reference
int.MinValue -2,147,483,648Reference
uint.MaxValue 4,294,967,295Reference
uint.MinValue 0 Reference
long.MaxValue 9,223,372,036,854,775,807Reference
long.MinValue -9,223,372,036,854,775,808 Reference
double.MinValuenegative 1.7976931348623157E+308.Reference
double.MaxValuepositive 1.7976931348623157E+308Reference