Show / Hide Table of Contents

    Struct Int16

    Represents a 16-bit signed integer.

    Inherited Members
    ValueType.Equals(Object)
    Object.Equals(Object, Object)
    Object.ReferenceEquals(Object, Object)
    Object.GetHashCode()
    Object.GetType()
    Namespace: System
    Assembly: mscorlib.dll
    Syntax
    public struct Int16

    Fields

    | Improve this Doc View Source

    MaxValue

    Represents the largest possible value of an Int16. This field is constant.

    Declaration
    public const short MaxValue = 32767
    Field Value
    Type Description
    Int16
    Remarks

    The value of this constant is 32767; that is, hexadecimal 0x7FFF.

    | Improve this Doc View Source

    MinValue

    Represents the smallest possible value of Int16. This field is constant.

    Declaration
    public const short MinValue = -32768
    Field Value
    Type Description
    Int16
    Remarks

    The value of this constant is -32768; that is, hexadecimal 0x8000.

    Methods

    | Improve this Doc View Source

    Parse(String)

    Converts the string representation of a number to its 16-bit signed integer equivalent.

    Declaration
    public static short Parse(string s)
    Parameters
    Type Name Description
    String s

    A string containing a number to convert.

    Returns
    Type Description
    Int16

    A 16-bit signed integer equivalent to the number contained in s.

    Exceptions
    Type Condition
    ArgumentNullException

    s is null.

    | Improve this Doc View Source

    ToString()

    Converts the numeric value of this instance to its equivalent string representation.

    Declaration
    public override string ToString()
    Returns
    Type Description
    String

    The string representation of the value of this instance, consisting of a minus sign if the value is negative, and a sequence of digits ranging from 0 to 9 with no leading zeroes.

    Overrides
    Object.ToString()
    | Improve this Doc View Source

    ToString(String)

    Converts the numeric value of this instance to its equivalent string representation, using the specified format

    Declaration
    public string ToString(string format)
    Parameters
    Type Name Description
    String format

    A numeric format string.

    Returns
    Type Description
    String

    The string representation of the value of this instance as specified by format.

    | Improve this Doc View Source

    TryParse(String, out 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.

    Declaration
    public static bool TryParse(string s, out short result)
    Parameters
    Type Name Description
    String s

    A String that contains a number to convert.

    Int16 result

    When this method returns, contains the 16-bit signed integer value equivalent to the number contained in s, if the conversion succeeded, or zero if the conversion failed. The conversion fails if the s parameter is null or Empty, is not of the correct format, or represents a number less than MinValue or greater than MaxValue. This parameter is passed uninitialized; any value originally supplied in result will be overwritten.

    Returns
    Type Description
    Boolean

    true if s was converted successfully; otherwise, false.

    Remarks

    The TryParse(String, out Int16) method differs from the Parse(String) method by returning a Boolean value that indicates whether the parse operation succeeded instead of returning the parsed Int16 value. It eliminates the need to use exception handling to test for a FormatException in the event that s is invalid and cannot be successfully parsed.

    • Improve this Doc
    • View Source
    Back to top Copyright © 2018 nanoFramework Contributors
    Generated by DocFX