UInt32.ToString Method is used to convert the numeric value of the current instance to its equivalent string representation. There are 4 methods in the overload list of this method as follows:
- ToString(IFormatProvider) Method
- ToString(String, IFormatProvider) Method
- ToString() Method
- ToString(String) Method
Here, we will discuss the last two methods.
ToString() Method
This method is used to convert the numeric value of the current instance to its equivalent string representation.
Syntax:
public override string ToString ();
Return Value: This method returns the string representation of the value of the current instance, consisting of a sequence of digits ranging from 0 to 9, without a sign or leading zeroes.
Example:
Output:
The String values are:
The Corresponding String Value is: 4294967295
The Corresponding String Value is: 0
The Corresponding String Value is: 155156
The Corresponding String Value is: 199947
ToString(String) Method
This method is used to convert the numeric value of the current instance to its equivalent string representation, using the specified format.
Syntax:
public string ToString (string format);
Parameters: This method takes numeric format string.
Return Value: This method returns the string representation of the value of this instance as specified by format.
Exception: This method will give
FormatException if the
format parameter is invalid.
Example: