#39 – MinValue / MaxValue for Numeric Types

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

 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

About Sean
Software developer in the Twin Cities area, passionate about .NET technologies. Equally passionate about my own personal projects related to family history and preservation of family stories and photos.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Connecting to %s

Follow

Get every new post delivered to your Inbox.

Join 43 other followers