C# Int64 Parse(String, IFormatProvider)

Description

Int64 Parse(String, IFormatProvider) converts the string representation of a number in a specified culture-specific format to its 64-bit signed integer equivalent.

Syntax

Int64.Parse(String, IFormatProvider) has the following syntax.


public static long Parse(
  string s,
  IFormatProvider provider
)

Parameters

Int64.Parse(String, IFormatProvider) has the following parameters.

  • s - A string containing a number to convert.
  • provider - An object that supplies culture-specific formatting information about s.
  • provider - An optional white space.
  • provider - An optional sign.
  • provider - A sequence of digits ranging from 0 to 9.

Returns

Int64.Parse(String, IFormatProvider) method returns A 64-bit signed integer equivalent to the number specified in s.

Example

The following code shows how to use Int64.Parse(String, IFormatProvider) method.


using System.Globalization;
using System;/*from   w  w  w.  j  a  va 2s. com*/
public class MainClass
{
    public static void Main(String[] argv)
    {
        long number;

        number = Int64.Parse("123", CultureInfo.InvariantCulture.NumberFormat);
        Console.WriteLine(number);
    }
}
    

The code above generates the following result.





















Home »
  C# Tutorial »
    System »




Array
BitConverter
Boolean
Byte
Char
Console
ConsoleKeyInfo
Convert
DateTime
DateTimeOffset
Decimal
Double
Enum
Environment
Exception
Guid
Int16
Int32
Int64
Math
OperatingSystem
Random
SByte
Single
String
StringComparer
TimeSpan
TimeZone
TimeZoneInfo
Tuple
Tuple
Tuple
Type
UInt16
UInt32
UInt64
Uri
Version