BitrixAQA.General.Shared.FormatBytes C# (CSharp) Method

FormatBytes() private static method

Конвертируем лонг в читабельное количество информации
private static FormatBytes ( long bytes ) : string
bytes long Конвертируемый лонг
return string
        private static string FormatBytes(long bytes)
        {
            string[] Suffix = { "B", "KB", "MB", "GB", "TB" };
            int i;
            double dblSByte = bytes;
            for (i = 0; i < Suffix.Length && bytes >= 1024; i++, bytes /= 1024)
                dblSByte = bytes / 1024.0;
            return String.Format("{0:0.##} {1}", dblSByte, Suffix[i]);
        }