public static string GetFileSize(this double size, Units unit = Units.B, string postFix = null) { if (size < 0) return defaultSizeReturn; while (size >= 1024) { size /= 1024; ++unit; } var s = $"{size:0.##} {unit}"; return postFix == null ? s : s + postFix; }