byte default format and leading zeros format
using System;
public class Example
{
public static void Main()
{
byte[] numbers = { 0, 16, 104, 213 };
foreach (byte number in numbers) {
// Display value using default formatting.
Console.Write("{0,-3} --> ", number.ToString());
// Display value with 3 digits and leading zeros.
Console.Write(number.ToString("D3") + " ");
}
}
}
Related examples in the same category