C# Int64 ToString(IFormatProvider)

Description

Int64 ToString(IFormatProvider) converts the numeric value of this instance to its equivalent string representation using the specified culture-specific format information.

Syntax

Int64.ToString(IFormatProvider) has the following syntax.


public string ToString(
  IFormatProvider provider
)

Parameters

Int64.ToString(IFormatProvider) has the following parameters.

  • provider - An IFormatProvider that supplies culture-specific formatting information.

Returns

Int64.ToString(IFormatProvider) method returns The string representation of the value of this instance as specified by provider.

Example

The following example displays the string representation of an Int64 value using CultureInfo objects that represent several different cultures.


using System.Globalization;
using System;//w ww .j  a v  a2s.c o m
public class MainClass{
  public static void Main(String[] argv){  
    long value = -12345678;
    // Display value using the invariant culture.
    Console.WriteLine(value.ToString(CultureInfo.InvariantCulture));
    // Display value using the en-GB culture.
    Console.WriteLine(value.ToString(CultureInfo.CreateSpecificCulture("en-GB")));
    // Display value using the de-DE culture.
    Console.WriteLine(value.ToString(CultureInfo.CreateSpecificCulture("de-DE")));

  }
}
    

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