UInt16.MinValue Alan

Tanım

mümkün olan en küçük değerini UInt16temsil eder. Bu alan sabittir.

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

Alan Değeri

Value = 0

Örnekler

Aşağıdaki örnek, bir değeri bir MinValue değere dönüştürmeden önce türün MaxValue aralığında olduğundan emin olmak için Int32 ve UInt16 özelliklerini kullanırUInt16. Bu, tamsayı değeri türün aralığında değilse dönüştürme işleminin bir OverflowException oluşturmasını UInt16 engeller.

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

Açıklamalar

Bu sabitin değeri 0'dır.

Şunlara uygulanır

Ayrıca bkz.