Mega Code Archive

 
Categories / C# / Data Types
 

Byte value standard string format

using System; using System.Globalization; public class Example {    public static void Main()    {         string[] formats = {"C4", "D5", "e1", "E2", "F3", "G", "N3",                              "P0", "X4", "0000.0000"};         byte number = 240;         foreach (string format in formats)            Console.WriteLine("'{0}' format specifier: {1}",                               format, number.ToString(format));    } }