Quantcast
Channel: Formatting C# output - Stack Overflow
Viewing all articles
Browse latest Browse all 4

Answer by btk for Formatting C# output

$
0
0

Take a look at this page, esp. the "Custom number formatting" section.

To show a number as two digits only you'd do something like this:

int x = 2;
string output = string.Format("{0:00}", x);
Console.WriteLine(output);

Viewing all articles
Browse latest Browse all 4

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>