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 있는지 확인하기 위해 UInt16MaxValue 속성을 사용합니다. 이렇게 하면 정수 값이 형식 범위에 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입니다.

적용 대상

추가 정보