C# UInt32 ToString()

Description

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

Syntax

UInt32.ToString() has the following syntax.


public override string ToString()

Returns

UInt32.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 UInt32 value by using the default ToString() method. It also displays the string representations of the UInt32 value that results from using some standard format specifiers.


/* www  . jav  a 2 s  .c  om*/
using System;

public class Example
{
   public static void Main()
   {
      uint value = 1234567;
      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