The topic you requested is included in another documentation set. For convenience, it's displayed below. Choose Switch to see the topic in its original location.
Int16::MaxValue Field
.NET Framework (current version)
Represents the largest possible value of an Int16. This field is constant.
Assembly: mscorlib (in mscorlib.dll)
The value of this constant is 32767; that is, hexadecimal 0x7FFF.
The MaxValue property is typically used to prevent an OverflowException when converting from a numeric type with a greater upper range (such as a UInt16 or a Int32) to an Int16. The example illustrates this usage.
The following example uses the MaxValue property to prevent an OverflowException when converting to an Int16 value.
array<Int64>^ numbersToConvert = {162345, 32183, -54000}; Int16 newNumber; for each (Int64 number in numbersToConvert) { if (number >= Int16::MinValue && number <= Int16::MaxValue) { newNumber = Convert::ToInt16(number); Console::WriteLine("Successfully converted {0} to an Int16.", newNumber); } else { Console::WriteLine("Unable to convert {0} to an Int16.", number); } } // The example displays the following output: // Unable to convert 162345 to an Int16. // Successfully converted 32183 to an Int16. // Unable to convert -54000 to an Int16.
Universal Windows Platform
Available since 8
.NET Framework
Available since 1.1
Portable Class Library
Supported in: portable .NET platforms
Silverlight
Available since 2.0
Windows Phone Silverlight
Available since 7.0
Windows Phone
Available since 8.1
Available since 8
.NET Framework
Available since 1.1
Portable Class Library
Supported in: portable .NET platforms
Silverlight
Available since 2.0
Windows Phone Silverlight
Available since 7.0
Windows Phone
Available since 8.1
Show: