namespace Quadarax.Foundation.Core.Value.Extensions { public static class LongExt { public static string ToReadableLengthString(this long owner) { string[] sizes = { "B", "KB", "MB", "GB", "TB" }; var order = 0; while (owner >= 1024 && order < sizes.Length - 1) { order++; owner /= 1024; } return $"{owner:0.##} {sizes[order]}"; } } }