Int16 Struct
Definition
Important
Some information relates to prerelease product that may be substantially modified before it’s released. Microsoft makes no warranties, express or implied, with respect to the information provided here.
Represents a 16-bit signed integer.
public value class short : IComparable, IComparable<short>, IConvertible, IEquatable<short>, IFormattable
public value class short : IComparable, IComparable<short>, IConvertible, IEquatable<short>, ISpanFormattable
public value class short : IComparable<short>, IConvertible, IEquatable<short>, IParsable<short>, ISpanParsable<short>, System::Numerics::IAdditionOperators<short, short, short>, System::Numerics::IAdditiveIdentity<short, short>, System::Numerics::IBinaryInteger<short>, System::Numerics::IBinaryNumber<short>, System::Numerics::IBitwiseOperators<short, short, short>, System::Numerics::IComparisonOperators<short, short, bool>, System::Numerics::IDecrementOperators<short>, System::Numerics::IDivisionOperators<short, short, short>, System::Numerics::IEqualityOperators<short, short, bool>, System::Numerics::IIncrementOperators<short>, System::Numerics::IMinMaxValue<short>, System::Numerics::IModulusOperators<short, short, short>, System::Numerics::IMultiplicativeIdentity<short, short>, System::Numerics::IMultiplyOperators<short, short, short>, System::Numerics::INumber<short>, System::Numerics::INumberBase<short>, System::Numerics::IShiftOperators<short, int, short>, System::Numerics::ISignedNumber<short>, System::Numerics::ISubtractionOperators<short, short, short>, System::Numerics::IUnaryNegationOperators<short, short>, System::Numerics::IUnaryPlusOperators<short, short>
public value class short : IComparable<short>, IConvertible, IEquatable<short>, IParsable<short>, ISpanParsable<short>, IUtf8SpanParsable<short>, System::Numerics::IAdditionOperators<short, short, short>, System::Numerics::IAdditiveIdentity<short, short>, System::Numerics::IBinaryInteger<short>, System::Numerics::IBinaryNumber<short>, System::Numerics::IBitwiseOperators<short, short, short>, System::Numerics::IComparisonOperators<short, short, bool>, System::Numerics::IDecrementOperators<short>, System::Numerics::IDivisionOperators<short, short, short>, System::Numerics::IEqualityOperators<short, short, bool>, System::Numerics::IIncrementOperators<short>, System::Numerics::IMinMaxValue<short>, System::Numerics::IModulusOperators<short, short, short>, System::Numerics::IMultiplicativeIdentity<short, short>, System::Numerics::IMultiplyOperators<short, short, short>, System::Numerics::INumber<short>, System::Numerics::INumberBase<short>, System::Numerics::IShiftOperators<short, int, short>, System::Numerics::ISignedNumber<short>, System::Numerics::ISubtractionOperators<short, short, short>, System::Numerics::IUnaryNegationOperators<short, short>, System::Numerics::IUnaryPlusOperators<short, short>
public value class short : IComparable, IConvertible, IFormattable
public value class short : IComparable, IComparable<short>, IEquatable<short>, IFormattable
public struct Int16 : IComparable, IComparable<short>, IConvertible, IEquatable<short>, IFormattable
public readonly struct Int16 : IComparable, IComparable<short>, IConvertible, IEquatable<short>, IFormattable
public readonly struct Int16 : IComparable, IComparable<short>, IConvertible, IEquatable<short>, ISpanFormattable
public readonly struct Int16 : IComparable<short>, IConvertible, IEquatable<short>, IParsable<short>, ISpanParsable<short>, System.Numerics.IAdditionOperators<short,short,short>, System.Numerics.IAdditiveIdentity<short,short>, System.Numerics.IBinaryInteger<short>, System.Numerics.IBinaryNumber<short>, System.Numerics.IBitwiseOperators<short,short,short>, System.Numerics.IComparisonOperators<short,short,bool>, System.Numerics.IDecrementOperators<short>, System.Numerics.IDivisionOperators<short,short,short>, System.Numerics.IEqualityOperators<short,short,bool>, System.Numerics.IIncrementOperators<short>, System.Numerics.IMinMaxValue<short>, System.Numerics.IModulusOperators<short,short,short>, System.Numerics.IMultiplicativeIdentity<short,short>, System.Numerics.IMultiplyOperators<short,short,short>, System.Numerics.INumber<short>, System.Numerics.INumberBase<short>, System.Numerics.IShiftOperators<short,int,short>, System.Numerics.ISignedNumber<short>, System.Numerics.ISubtractionOperators<short,short,short>, System.Numerics.IUnaryNegationOperators<short,short>, System.Numerics.IUnaryPlusOperators<short,short>
public readonly struct Int16 : IComparable<short>, IConvertible, IEquatable<short>, IParsable<short>, ISpanParsable<short>, IUtf8SpanParsable<short>, System.Numerics.IAdditionOperators<short,short,short>, System.Numerics.IAdditiveIdentity<short,short>, System.Numerics.IBinaryInteger<short>, System.Numerics.IBinaryNumber<short>, System.Numerics.IBitwiseOperators<short,short,short>, System.Numerics.IComparisonOperators<short,short,bool>, System.Numerics.IDecrementOperators<short>, System.Numerics.IDivisionOperators<short,short,short>, System.Numerics.IEqualityOperators<short,short,bool>, System.Numerics.IIncrementOperators<short>, System.Numerics.IMinMaxValue<short>, System.Numerics.IModulusOperators<short,short,short>, System.Numerics.IMultiplicativeIdentity<short,short>, System.Numerics.IMultiplyOperators<short,short,short>, System.Numerics.INumber<short>, System.Numerics.INumberBase<short>, System.Numerics.IShiftOperators<short,int,short>, System.Numerics.ISignedNumber<short>, System.Numerics.ISubtractionOperators<short,short,short>, System.Numerics.IUnaryNegationOperators<short,short>, System.Numerics.IUnaryPlusOperators<short,short>
[System.Serializable]
public struct Int16 : IComparable, IConvertible, IFormattable
[System.Serializable]
[System.Runtime.InteropServices.ComVisible(true)]
public struct Int16 : IComparable, IComparable<short>, IConvertible, IEquatable<short>, IFormattable
public struct Int16 : IComparable, IComparable<short>, IEquatable<short>, IFormattable
type int16 = struct
interface IConvertible
interface IFormattable
type int16 = struct
interface IConvertible
interface ISpanFormattable
interface IFormattable
type int16 = struct
interface IConvertible
interface IFormattable
interface IParsable<int16>
interface ISpanFormattable
interface ISpanParsable<int16>
interface IAdditionOperators<int16, int16, int16>
interface IAdditiveIdentity<int16, int16>
interface IBinaryInteger<int16>
interface IBinaryNumber<int16>
interface IBitwiseOperators<int16, int16, int16>
interface IComparisonOperators<int16, int16, bool>
interface IEqualityOperators<int16, int16, bool>
interface IDecrementOperators<int16>
interface IDivisionOperators<int16, int16, int16>
interface IIncrementOperators<int16>
interface IModulusOperators<int16, int16, int16>
interface IMultiplicativeIdentity<int16, int16>
interface IMultiplyOperators<int16, int16, int16>
interface INumber<int16>
interface INumberBase<int16>
interface ISubtractionOperators<int16, int16, int16>
interface IUnaryNegationOperators<int16, int16>
interface IUnaryPlusOperators<int16, int16>
interface IShiftOperators<int16, int, int16>
interface IMinMaxValue<int16>
interface ISignedNumber<int16>
type int16 = struct
interface IConvertible
interface IFormattable
interface IParsable<int16>
interface ISpanFormattable
interface ISpanParsable<int16>
interface IAdditionOperators<int16, int16, int16>
interface IAdditiveIdentity<int16, int16>
interface IBinaryInteger<int16>
interface IBinaryNumber<int16>
interface IBitwiseOperators<int16, int16, int16>
interface IComparisonOperators<int16, int16, bool>
interface IEqualityOperators<int16, int16, bool>
interface IDecrementOperators<int16>
interface IDivisionOperators<int16, int16, int16>
interface IIncrementOperators<int16>
interface IModulusOperators<int16, int16, int16>
interface IMultiplicativeIdentity<int16, int16>
interface IMultiplyOperators<int16, int16, int16>
interface INumber<int16>
interface INumberBase<int16>
interface ISubtractionOperators<int16, int16, int16>
interface IUnaryNegationOperators<int16, int16>
interface IUnaryPlusOperators<int16, int16>
interface IUtf8SpanFormattable
interface IUtf8SpanParsable<int16>
interface IShiftOperators<int16, int, int16>
interface IMinMaxValue<int16>
interface ISignedNumber<int16>
type int16 = struct
interface IConvertible
interface IFormattable
interface IParsable<int16>
interface ISpanFormattable
interface ISpanParsable<int16>
interface IUtf8SpanFormattable
interface IUtf8SpanParsable<int16>
interface IAdditionOperators<int16, int16, int16>
interface IAdditiveIdentity<int16, int16>
interface IBinaryInteger<int16>
interface IBinaryNumber<int16>
interface IBitwiseOperators<int16, int16, int16>
interface IComparisonOperators<int16, int16, bool>
interface IEqualityOperators<int16, int16, bool>
interface IDecrementOperators<int16>
interface IDivisionOperators<int16, int16, int16>
interface IIncrementOperators<int16>
interface IModulusOperators<int16, int16, int16>
interface IMultiplicativeIdentity<int16, int16>
interface IMultiplyOperators<int16, int16, int16>
interface INumber<int16>
interface INumberBase<int16>
interface ISubtractionOperators<int16, int16, int16>
interface IUnaryNegationOperators<int16, int16>
interface IUnaryPlusOperators<int16, int16>
interface IShiftOperators<int16, int, int16>
interface IMinMaxValue<int16>
interface ISignedNumber<int16>
[<System.Serializable>]
type int16 = struct
interface IFormattable
interface IConvertible
[<System.Serializable>]
[<System.Runtime.InteropServices.ComVisible(true)>]
type int16 = struct
interface IFormattable
interface IConvertible
type int16 = struct
interface IFormattable
Public Structure Int16
Implements IComparable, IComparable(Of Short), IConvertible, IEquatable(Of Short), IFormattable
Public Structure Int16
Implements IComparable, IComparable(Of Short), IConvertible, IEquatable(Of Short), ISpanFormattable
Public Structure Int16
Implements IAdditionOperators(Of Short, Short, Short), IAdditiveIdentity(Of Short, Short), IBinaryInteger(Of Short), IBinaryNumber(Of Short), IBitwiseOperators(Of Short, Short, Short), IComparable(Of Short), IComparisonOperators(Of Short, Short, Boolean), IConvertible, IDecrementOperators(Of Short), IDivisionOperators(Of Short, Short, Short), IEqualityOperators(Of Short, Short, Boolean), IEquatable(Of Short), IIncrementOperators(Of Short), IMinMaxValue(Of Short), IModulusOperators(Of Short, Short, Short), IMultiplicativeIdentity(Of Short, Short), IMultiplyOperators(Of Short, Short, Short), INumber(Of Short), INumberBase(Of Short), IParsable(Of Short), IShiftOperators(Of Short, Integer, Short), ISignedNumber(Of Short), ISpanParsable(Of Short), ISubtractionOperators(Of Short, Short, Short), IUnaryNegationOperators(Of Short, Short), IUnaryPlusOperators(Of Short, Short)
Public Structure Int16
Implements IAdditionOperators(Of Short, Short, Short), IAdditiveIdentity(Of Short, Short), IBinaryInteger(Of Short), IBinaryNumber(Of Short), IBitwiseOperators(Of Short, Short, Short), IComparable(Of Short), IComparisonOperators(Of Short, Short, Boolean), IConvertible, IDecrementOperators(Of Short), IDivisionOperators(Of Short, Short, Short), IEqualityOperators(Of Short, Short, Boolean), IEquatable(Of Short), IIncrementOperators(Of Short), IMinMaxValue(Of Short), IModulusOperators(Of Short, Short, Short), IMultiplicativeIdentity(Of Short, Short), IMultiplyOperators(Of Short, Short, Short), INumber(Of Short), INumberBase(Of Short), IParsable(Of Short), IShiftOperators(Of Short, Integer, Short), ISignedNumber(Of Short), ISpanParsable(Of Short), ISubtractionOperators(Of Short, Short, Short), IUnaryNegationOperators(Of Short, Short), IUnaryPlusOperators(Of Short, Short), IUtf8SpanParsable(Of Short)
Public Structure Int16
Implements IComparable, IConvertible, IFormattable
Public Structure Int16
Implements IComparable, IComparable(Of Short), IEquatable(Of Short), IFormattable
- Inheritance
- Attributes
- Implements
-
IComparable IComparable<Int16> IConvertible IEquatable<Int16> IFormattable ISpanFormattable IComparable<TSelf> IEquatable<TSelf> IParsable<Int16> IParsable<TSelf> ISpanParsable<Int16> ISpanParsable<TSelf> IAdditionOperators<Int16,Int16,Int16> IAdditionOperators<TSelf,TSelf,TSelf> IAdditiveIdentity<Int16,Int16> IAdditiveIdentity<TSelf,TSelf> IBinaryInteger<Int16> IBinaryNumber<Int16> IBinaryNumber<TSelf> IBitwiseOperators<Int16,Int16,Int16> IBitwiseOperators<TSelf,TSelf,TSelf> IComparisonOperators<Int16,Int16,Boolean> IComparisonOperators<TSelf,TSelf,Boolean> IDecrementOperators<Int16> IDecrementOperators<TSelf> IDivisionOperators<Int16,Int16,Int16> IDivisionOperators<TSelf,TSelf,TSelf> IEqualityOperators<Int16,Int16,Boolean> IEqualityOperators<TSelf,TOther,TResult> IEqualityOperators<TSelf,TSelf,Boolean> IIncrementOperators<Int16> IIncrementOperators<TSelf> IMinMaxValue<Int16> IModulusOperators<Int16,Int16,Int16> IModulusOperators<TSelf,TSelf,TSelf> IMultiplicativeIdentity<Int16,Int16> IMultiplicativeIdentity<TSelf,TSelf> IMultiplyOperators<Int16,Int16,Int16> IMultiplyOperators<TSelf,TSelf,TSelf> INumber<Int16> INumber<TSelf> INumberBase<Int16> INumberBase<TSelf> IShiftOperators<Int16,Int32,Int16> IShiftOperators<TSelf,Int32,TSelf> ISignedNumber<Int16> ISubtractionOperators<Int16,Int16,Int16> ISubtractionOperators<TSelf,TSelf,TSelf> IUnaryNegationOperators<Int16,Int16> IUnaryNegationOperators<TSelf,TSelf> IUnaryPlusOperators<Int16,Int16> IUnaryPlusOperators<TSelf,TSelf> IUtf8SpanFormattable IUtf8SpanParsable<Int16> IUtf8SpanParsable<TSelf>
Remarks
The Int16 value type represents signed integers with values ranging from negative 32768 through positive 32767.
This type provides methods to convert the value of an instance of this type to its string representation, to convert the string representation of a number to an instance of this type, and to compare instances of this type.
You can also call the members of the Math class to perform a wide range of numeric operations, including getting the absolute value of a number, calculating the quotient and remainder from integral division, determining the maximum or minimum value of two integers, getting the sign of a number, and rounding a number.
For information about how format specification codes control the string representation of value types, see Formatting Types.
Fields
MaxValue |
Represents the largest possible value of an Int16. This field is constant. |
MinValue |
Represents the smallest possible value of Int16. This field is constant. |
Methods
Abs(Int16) |
Computes the absolute of a value. |
Clamp(Int16, Int16, Int16) |
Clamps a value to an inclusive minimum and maximum value. |
CompareTo(Int16) |
Compares this instance to a specified 16-bit signed integer and returns an integer that indicates whether the value of this instance is less than, equal to, or greater than the value of the specified 16-bit signed integer. |
CompareTo(Object) |
Compares this instance to a specified object and returns an integer that indicates whether the value of this instance is less than, equal to, or greater than the value of the object. |
CopySign(Int16, Int16) |
Copies the sign of a value to the sign of another value. |
CreateChecked<TOther>(TOther) |
Creates an instance of the current type from a value, throwing an overflow exception for any values that fall outside the representable range of the current type. |
CreateSaturating<TOther>(TOther) |
Creates an instance of the current type from a value, saturating any values that fall outside the representable range of the current type. |
CreateTruncating<TOther>(TOther) |
Creates an instance of the current type from a value, truncating any values that fall outside the representable range of the current type. |
DivRem(Int16, Int16) |
Computes the quotient and remainder of two values. |
Equals(Int16) |
Returns a value indicating whether this instance is equal to a specified Int16 value. |
Equals(Object) |
Returns a value indicating whether this instance is equal to a specified object. |
GetHashCode() |
Returns the hash code for this instance. |
GetTypeCode() | |
IsEvenInteger(Int16) |
Determines if a value represents an even integral number. |
IsNegative(Int16) |
Determines if a value is negative. |
IsOddInteger(Int16) |
Determines if a value represents an odd integral number. |
IsPositive(Int16) |
Determines if a value is positive. |
IsPow2(Int16) |
Determines if a value is a power of two. |
LeadingZeroCount(Int16) |
Computes the number of leading zeros in a value. |
Log2(Int16) |
Computes the log2 of a value. |
Max(Int16, Int16) |
Compares two values to compute which is greater. |
MaxMagnitude(Int16, Int16) |
Compares two values to compute which is greater. |
Min(Int16, Int16) |
Compares two values to compute which is lesser. |
MinMagnitude(Int16, Int16) |
Compares two values to compute which is lesser. |
Parse(ReadOnlySpan<Byte>, IFormatProvider) |
Parses a span of UTF-8 characters into a value. |
Parse(ReadOnlySpan<Byte>, NumberStyles, IFormatProvider) |
Parses a span of UTF-8 characters into a value. |
Parse(ReadOnlySpan<Char>, IFormatProvider) |
Parses a span of characters into a value. |
Parse(ReadOnlySpan<Char>, NumberStyles, IFormatProvider) |
Converts the span representation of a number in a specified style and culture-specific format to its 16-bit signed integer equivalent. |
Parse(String, IFormatProvider) |
Converts the string representation of a number in a specified culture-specific format to its 16-bit signed integer equivalent. |
Parse(String, NumberStyles, IFormatProvider) |
Converts the string representation of a number in a specified style and culture-specific format to its 16-bit signed integer equivalent. |
Parse(String, NumberStyles) |
Converts the string representation of a number in a specified style to its 16-bit signed integer equivalent. |
Parse(String) |
Converts the string representation of a number to its 16-bit signed integer equivalent. |
PopCount(Int16) |
Computes the number of bits that are set in a value. |
RotateLeft(Int16, Int32) |
Rotates a value left by a given amount. |
RotateRight(Int16, Int32) |
Rotates a value right by a given amount. |
Sign(Int16) |
Computes the sign of a value. |
ToString() |
Converts the numeric value of this instance to its equivalent string representation. |
ToString(IFormatProvider) |
Converts the numeric value of this instance to its equivalent string representation using the specified culture-specific format information. |
ToString(String, IFormatProvider) |
Converts the numeric value of this instance to its equivalent string representation using the specified format and culture-specific formatting information. |
ToString(String) |
Converts the numeric value of this instance to its equivalent string representation, using the specified format. |
TrailingZeroCount(Int16) |
Computes the number of trailing zeros in a value. |
TryFormat(Span<Byte>, Int32, ReadOnlySpan<Char>, IFormatProvider) |
Tries to format the value of the current instance as UTF-8 into the provided span of bytes. |
TryFormat(Span<Char>, Int32, ReadOnlySpan<Char>, IFormatProvider) |
Tries to format the value of the current short number instance into the provided span of characters. |
TryParse(ReadOnlySpan<Byte>, IFormatProvider, Int16) |
Tries to parse a span of UTF-8 characters into a value. |
TryParse(ReadOnlySpan<Byte>, Int16) |
Tries to convert a UTF-8 character span containing the string representation of a number to its 16-bit signed integer equivalent. |
TryParse(ReadOnlySpan<Byte>, NumberStyles, IFormatProvider, Int16) |
Tries to parse a span of UTF-8 characters into a value. |
TryParse(ReadOnlySpan<Char>, IFormatProvider, Int16) |
Tries to parse a span of characters into a value. |
TryParse(ReadOnlySpan<Char>, Int16) |
Converts the span representation of a number in a culture-specific format to its 16-bit signed integer equivalent. A return value indicates whether the conversion succeeded or failed. |
TryParse(ReadOnlySpan<Char>, NumberStyles, IFormatProvider, Int16) |
Converts the span representation of a number in a specified style and culture-specific format to its 16-bit signed integer equivalent. A return value indicates whether the conversion succeeded or failed. |
TryParse(String, IFormatProvider, Int16) |
Tries to parse a string into a value. |
TryParse(String, Int16) |
Converts the string representation of a number to its 16-bit signed integer equivalent. A return value indicates whether the conversion succeeded or failed. |
TryParse(String, NumberStyles, IFormatProvider, Int16) |
Converts the string representation of a number in a specified style and culture-specific format to its 16-bit signed integer equivalent. A return value indicates whether the conversion succeeded or failed. |
Explicit Interface Implementations
Applies to
Thread Safety
All members of this type are thread safe. Members that appear to modify instance state actually return a new instance initialized with the new value. As with any other type, reading and writing to a shared variable that contains an instance of this type must be protected by a lock to guarantee thread safety.