UInt16.MinValue Pole
Definice
Důležité
Některé informace platí pro předběžně vydaný produkt, který se může zásadně změnit, než ho výrobce nebo autor vydá. Microsoft neposkytuje žádné záruky, výslovné ani předpokládané, týkající se zde uváděných informací.
Představuje nejmenší možnou UInt16hodnotu . Toto pole je konstantní.
public: System::UInt16 MinValue = 0;
public const ushort MinValue = 0;
val mutable MinValue : uint16
Public Const MinValue As UShort = 0
Hodnota pole
Value = 0Příklady
Následující příklad používá MinValue a MaxValue vlastnosti k zajištění, že Int32 hodnota je v rozsahu UInt16 typu před převodem UInt16 na hodnotu. Tím zabráníte operaci převodu vyvolat, OverflowException pokud celočíselná hodnota není v rozsahu UInt16 typu.
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
Poznámky
Hodnota této konstanty je 0.