C# UInt64 ToString()

Description

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

Syntax

UInt64.ToString() has the following syntax.


public override string ToString()

Returns

UInt64.ToString() method returns The string representation of the value of this instance, consisting of a sequence of digits ranging from 0 to 9, without a sign or leading zeroes.

Example

The following example displays a UInt64 value by using the default ToString() method. It also displays the string representations of the UInt64 value that results from using some standard format specifiers.


using System;// w  w  w  .  jav a 2s.co  m

public class Example
{
   public static void Main()
   {
      ulong value = 123456789;
      Console.WriteLine(value.ToString());      
      Console.WriteLine();

      string[] formats = { "G", "C", "D", "F", "N", "X" };
      
      foreach (string format in formats)
         Console.WriteLine("{0} format specifier: {1,16}", 
                           format, value.ToString(format));         
   }
}

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