int16
Struct · built-in type
struct int16 : IComparable<int16>, IEquatable<int16>, IHashableA signed 16-bit integer.
Arithmetic is checked: an overflow, a division by zero or a conversion that loses the value ends the program
with a panic, unless the code is unchecked (then it wraps around). See the language guide (basics).
Static fields
Section titled “Static fields”| Name | Description |
|---|---|
MinValue |
The smallest value, -32768. |
MaxValue |
The largest value, 32767. |
MinValue
Section titled “MinValue”static int16 MinValueThe smallest value, -32768.
MaxValue
Section titled “MaxValue”static int16 MaxValueThe largest value, 32767.
Methods
Section titled “Methods”| Name | Description |
|---|---|
ToString |
The number as decimal text: 42.ToString() is "42". |
Equals |
Whether the numbers are equal (also a == b). |
CompareTo |
Compares the numbers: -1, 0 or 1. |
GetHashCode |
A hash code of the number, for Dictionary keys. |
ToString
Section titled “ToString”string ToString()The number as decimal text: 42.ToString() is "42".
string ToString(string format)The number in a number format: 255.ToString("X4") is "00FF" (see NumberFormat).
Parameters
format:D,X,B,F,N,E,PorG, optionally followed by up to two digits.
Equals
Section titled “Equals”bool Equals(int16 other)Whether the numbers are equal (also a == b).
CompareTo
Section titled “CompareTo”int CompareTo(int16 other)Compares the numbers: -1, 0 or 1.
GetHashCode
Section titled “GetHashCode”int GetHashCode()A hash code of the number, for Dictionary keys.