withSIX.Core.Extensions.FileSizeHelper.GetFileSize C# (CSharp) Method

GetFileSize() public static method

public static GetFileSize ( this size, Units unit = Units.B, string postFix = null ) : string
size this
unit Units
postFix string
return string
        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;
        }
FileSizeHelper