Byte.MinValue Field
.NET Framework 1.1
Represents the smallest possible value of a Byte. This field is constant.
[Visual Basic] Public Const MinValue As Byte [C#] public const byte MinValue; [C++] public: const unsigned char MinValue; [JScript] public var MinValue : Byte;
Remarks
The value of this constant is 0.
Example
[Visual Basic] Public Sub MinMaxFields(ByVal numberToSet As Integer) If numberToSet <= CInt([Byte].MaxValue) And numberToSet >= CInt([Byte].MinValue) Then ' You must explicitly convert an integer to a byte. MemberByte = CType(numberToSet, [Byte]) ' 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()) End If End Sub 'MinMaxFields [C#] 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()); } } [C++] void MinMaxFields(Int32 numberToSet) { if(numberToSet <= (Int32)Byte::MaxValue && numberToSet >= (Int32)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()); } }
[JScript] No example is available for JScript. To view a Visual Basic, C#, or C++ example, click the Language Filter button
in the upper-left corner of the page.
Requirements
Platforms: Windows 98, Windows NT 4.0, Windows Millennium Edition, Windows 2000, Windows XP Home Edition, Windows XP Professional, Windows Server 2003 family, .NET Compact Framework, Common Language Infrastructure (CLI) Standard