Int64.Parse(String) Method is used to convert the string representation of a number to its 64-bit signed integer equivalent.
Syntax:
public static long Parse (string str);
Here,
str is a string containing a number to convert. The format of
str will be
[optional white space][optional sign]digits[optional white space].
Return Value: It is a 64-bit signed integer equivalent to the number contained in
str.
Exceptions:
- ArgumentNullException: If str is null.
- FormatException: If str is not in the correct format.
- OverflowException: If str represents a number less than MinValue or greater than MaxValue.
Below programs illustrate the use of above-discussed method:
Example 1:
Output:
'9223372036854775807' parsed as 9223372036854775807
Can't Parsed '29,22337,20368547'
'-922337203685477' parsed as -922337203685477
' 9223372075807' parsed as 9223372075807
Example 2: For
ArgumentNullException