Byte.MaxValue Field
.NET Framework 4.5
Represents the largest possible value of a Byte. This field is constant.
Namespace: System
Assembly: mscorlib (in mscorlib.dll)
The following example demonstrates how to use the MaxValue field to screen variable inputs for values that are outside the range of possible byte values.
public void MinMaxFields(int numberToSet) { if(numberToSet <= (int)Byte.MaxValue && numberToSet >= (int)Byte.MinValue) { // You must explicitly convert an integer to a byte. MemberByte = (Byte)numberToSet; // Displays MemberByte using the ToString() method. Console.WriteLine("The MemberByte value is {0}", MemberByte.ToString()); } else { Console.WriteLine("The value {0} is outside of the range of possible Byte values", numberToSet.ToString()); } }
Windows 8, Windows Server 2012, Windows 7, Windows Vista SP2, Windows Server 2008 (Server Core Role not supported), Windows Server 2008 R2 (Server Core Role supported with SP1 or later; Itanium not supported)
The .NET Framework does not support all versions of every platform. For a list of the supported versions, see .NET Framework System Requirements.