UInt16.MinValue 필드

정의

UInt16의 가능한 최소값을 나타냅니다. 이 필드는 상수입니다.

public: System::UInt16 MinValue = 0;
public const ushort MinValue = 0;
val mutable MinValue : uint16
Public Const MinValue As UShort  = 0

필드 값

Value = 0

예제

다음 예제에서는 및 속성을 사용하여 MinValue 값을 값으로 Int32 변환 UInt16 하기 전에 값이 UInt16 형식의 범위에 있는지 확인 MaxValue 합니다. 이렇게 하면 정수 값이 형식의 UInt16 범위에 없는 경우 변환 작업이 을 throw OverflowException 하지 않습니다.

int integerValue = 1216; 
ushort uIntegerValue;

if (integerValue >= ushort.MinValue & integerValue <= ushort.MaxValue)
{
   uIntegerValue = (ushort) integerValue;
   Console.WriteLine(uIntegerValue);
} 
else
{
   Console.WriteLine("Unable to convert {0} to a UInt16t.", integerValue);
}
open System

let integerValue = 1216

if integerValue >= int UInt16.MinValue && integerValue <= int UInt16.MaxValue then
    let uIntegerValue = uint16 integerValue
    printfn $"{uIntegerValue}"
else
    printfn $"Unable to convert {integerValue} to a UInt16t."
Dim integerValue As Integer = 1216
Dim uIntegerValue As UShort

If integerValue >= UShort.MinValue And integerValue <= UShort.MaxValue Then
   uIntegerValue = CUShort(integerValue) 
   Console.WriteLine(uIntegerValue)
Else
   Console.WriteLine("Unable to convert {0} to a UInt16t.", integerValue)   
End If

설명

이 상수의 값은 0입니다.

적용 대상

추가 정보