using System.Globalization;
var options = BinarySizeOptions.AllowLongUnits;
Console.Write("Enter a quantity with a unit like KB, MiB, etc. (e.g. '3.5 GiB'): ");
var input = Console.ReadLine();
if (!BinarySize.TryParse(input, options, NumberStyles.Number, CultureInfo.CurrentCulture, out var size))
Console.WriteLine("Invalid input.");
Console.WriteLine($"The value you entered was {size:#,### byte}");
Console.WriteLine($"With the largest unit with a whole number, that is {size: AiB}");
Console.WriteLine($"With the shortest possible format, that is {size:0.# SiB}");
Console.WriteLine($"With the shortest possible format using a decimal prefix, that is {size:0.### sB}");
Console.WriteLine("And with unabbreviated units:");
Console.WriteLine($"With the largest unit with a whole number, that is {size: Aibyte}");
Console.WriteLine($"With the shortest possible format, that is {size:0.# Sibyte}");
Console.WriteLine($"With the shortest possible format using a decimal prefix, that is {size:0.### sbyte}");
var formats = new[] { (BinarySize.Kibi, "#,###.## KiB"), (BinarySize.Mebi, "#,###.## MiB"), (BinarySize.Gibi, "#,###.## GiB"),
(BinarySize.Tebi, "#,###.## TiB"), (BinarySize.Pebi, "#,###.## PiB"), (BinarySize.Exbi, "#,###.## EiB") };
Console.WriteLine("It's also:");
foreach (var format in formats)
Console.WriteLine(size.ToString(format.Item2));