C# UInt64 Parse(String, IFormatProvider)

Description

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

Syntax

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


[CLSCompliantAttribute(false)]/*from   w  w w  .ja  va 2  s. c o  m*/
public static ulong Parse(
  string s,
  IFormatProvider provider
)

Parameters

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

  • s - A string that represents the number to convert.
  • provider - An object that supplies culture-specific formatting information about s.

Returns

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

Example

The following example shows how to use UInt64.Parse(String, IFormatProvider).


//  w ww . ja v  a 2s.c  o m
using System.Globalization;
using System;
public class MainClass{
  public static void Main(String[] argv){  
       string locale;
       float number;
       CultureInfo culture = new CultureInfo("en-US");
    
       try
       {
          number = Single.Parse("123", culture.NumberFormat);
       }
       catch (FormatException)
       {
          return;
       }
       catch (Exception)
       {
          return;
       }

  }
}
    

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