C# Single ToString()
Description
Single ToString()
converts the numeric value of this
instance to its equivalent string representation.
Syntax
Single.ToString()
has the following syntax.
public override string ToString()
Returns
Single.ToString()
method returns The string representation of the value of this instance.
Example
The following example uses the default Single.ToString method to display the string representations of a number of Single values.
/* www . ja v a 2s . c om*/
using System;
public class MainClass{
public static void Main(String[] argv){
float number = 1.6E20F;
Console.WriteLine(number.ToString());
number = 1.6E2F;
Console.WriteLine(number.ToString());
number = -3.123F;
Console.WriteLine(number.ToString());
number = -1234567892199E-07F;
Console.WriteLine(number.ToString());
number = -12345678221990199574E-09F;
Console.WriteLine(number.ToString());
number = .12345F;
Console.WriteLine(number.ToString());
number = .000000001F;
Console.WriteLine(number.ToString());
}
}
The code above generates the following result.