uint16
struct uint16Available without an import.
A 16-bit unsigned integer with default value zero. Parsing accepts bases 2 through 36 and stops
at trailing non-digit text. Use ParseDetailed for a structured error instead of null.
Members
constructorconstructor
public constructor ()Creates zero.
MinValueconst
const uint16 MinValue = 0The smallest value representable by this integer type.
MaxValueconst
const uint16 MaxValue = 65535The largest value representable by this integer type.
GetHashCodemethod
public fn GetHashCode() : uint32Returns a hash consistent with integer value equality.
ToStringmethod
public fn ToString() : stringReturns base-10 text without grouping separators.
ToStringBuffermethod
public fn ToStringBuffer(StringBuilder builder) : int32Appends the same text as ToString and returns the number of UTF-8 bytes appended.
Formatmethod
public fn Format(string fmt) : stringFormats decimal by default, hexadecimal for X/x, or binary for B/b. A decimal suffix selects minimum digit width, capped at 99, with zero padding. No base prefix or sign is added.
FormatBuffermethod
public fn FormatBuffer(StringBuilder builder, string fmt) : int32Appends formatted integer text and returns the number of UTF-8 bytes appended.
Equalsmethod
public fn Equals(uint16 other) : boolTests integer value equality.
CompareTomethod
public fn CompareTo(uint16 other) : int32Returns -1, 0, or 1 for less, equal, or greater.
Parsemethod
public static fn Parse(string text, int32 radix = 10) : uint16?Uses ParseDetailed syntax, returning null instead of throwing on failure. A successful
prefix does not imply the entire input was numeric.
ParseDetailedmethod
public static fn ParseDetailed(string text, int32 radix = 10) : uint16 throws ParseErrorParses a base-2 through base-36 prefix, skipping leading spaces/tabs and accepting a sign.
After the first digit, underscores are ignored and the first invalid digit ends parsing.
Throws ParseError for missing/invalid digits, an unsupported radix, or a value outside
this type's range. A minus sign is rejected, including for zero.
Reinterpretmethod
public fn Reinterpret<T>() : T where T is numericReinterprets bits as a numeric type of the same width rather than converting the numeric value. Incompatible widths are rejected. Floating-point NaNs are canonicalized when entering or leaving a floating-point type; NaN payload bits are not preserved.