C# UInt64 ToString(String)

Description

UInt64 ToString(String) converts the numeric value of this instance to its equivalent string representation using the specified format.

Syntax

UInt64.ToString(String) has the following syntax.


public string ToString(
  string format
)

Parameters

UInt64.ToString(String) has the following parameters.

  • format - A numeric format string.

Returns

UInt64.ToString(String) method returns The string representation of the value of this instance as specified by format.

Example

The following example displays a 64-bit unsigned integer value by using each standard format string and some custom format strings.


using System;/*ww w  .  ja v  a 2 s .c o m*/
using System.Globalization;

public class Example
{
   public static void Main()
   {
      ulong value = 123456789;
      string[] specifiers = { "G", "C", "D3", "E2", "e3", "F", 
                              "N", "P", "X", "000000.0", "#.0", 
                              "00000000;(0);**Zero**" };

      foreach (string specifier in specifiers)
         Console.WriteLine("{0}: {1}", specifier, value.ToString(specifier));
   }
}

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