Struct long
Represents a 64-bit signed integer.
Inherited Members
Namespace: System
Assembly: mscorlib.dll
Syntax
public long
Fields
MaxValue
Represents the largest possible value of an Int64. This field is constant.
Declaration
public const long MaxValue = 9223372036854775807
Field Value
Type | Description |
---|---|
long |
Remarks
The value of this constant is 9,223,372,036,854,775,807; that is, hexadecimal 0x7FFFFFFFFFFFFFFF.
MinValue
Represents the smallest possible value of an Int64. This field is constant.
Declaration
public const long MinValue = -9223372036854775808
Field Value
Type | Description |
---|---|
long |
Remarks
The value of this constant is negative 9,223,372,036,854,775,808; that is, hexadecimal 0x8000000000000000.
Methods
Parse(string)
Converts the string representation of a number to its 64-bit signed integer equivalent.
Declaration
public static long Parse(string s)
Parameters
Type | Name | Description |
---|---|---|
string | s | A string containing a number to convert. |
Returns
Type | Description |
---|---|
long | A 64-bit signed integer equivalent to the number contained in s. |
Exceptions
Type | Condition |
---|---|
ArgumentNullException |
|
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
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. |
TryParse(string, out long)
Converts the string representation of a number to its 64-bit signed integer equivalent. A return value indicates whether the conversion succeeded.
Declaration
public static bool TryParse(string s, out long result)
Parameters
Type | Name | Description |
---|---|---|
string | s | Converts the string representation of a number to its 64-bit signed integer equivalent. A return value indicates whether the conversion succeeded. |
long | result | When this method returns, contains the 64-bit signed integer value equivalent of the number contained in |
Returns
Type | Description |
---|---|
bool |
Remarks
The TryParse(string, out long) method is like the Parse(string) method, except the TryParse(string, out long) method does not throw an exception if the conversion fails. 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.