Byte.MaxValue 필드
Byte의 최대값을 나타냅니다. 이 필드는 상수입니다.
네임스페이스: System
어셈블리: mscorlib(mscorlib.dll)
구문
‘선언
Public Const MaxValue As Byte
‘사용 방법
Dim value As Byte
value = Byte.MaxValue
public const byte MaxValue
public:
literal unsigned char MaxValue
public static final byte MaxValue
public const var MaxValue : byte
설명
이 상수의 값은 255(16진수 0xFFFF)입니다.
예제
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
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());
}
}
public:
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() );
}
}
public void MinMaxFields(int numberToSet)
{
if (numberToSet <= (int)(System.Byte.MaxValue)
&& numberToSet >= (int)(System.Byte.MinValue)) {
// You must explicitly convert an integer to a byte.
memberByte = ((ubyte)(numberToSet));
// Displays MemberByte using the ToString() method.
Console.WriteLine("The memberByte value is {0}",
System.Convert.ToString(memberByte));
}
else {
Console.WriteLine("The value {0} is outside of the range of "
+ "possible Byte values", (Int32)numberToSet);
}
} //MinMaxFields
플랫폼
Windows 98, Windows 2000 SP4, Windows CE, Windows Millennium Edition, Windows Mobile for Pocket PC, Windows Mobile for Smartphone, Windows Server 2003, Windows XP Media Center Edition, Windows XP Professional x64 Edition, Windows XP SP2, Windows XP Starter Edition
.NET Framework에서 모든 플래폼의 모든 버전을 지원하지는 않습니다. 지원되는 버전의 목록은 시스템 요구 사항을 참조하십시오.
버전 정보
.NET Framework
2.0, 1.1, 1.0에서 지원
.NET Compact Framework
2.0, 1.0에서 지원