CmisSync.Lib.Utils.FormatBandwidth C# (CSharp) Метод

FormatBandwidth() публичный статический Метод

Formats the bandwidth in typical 10 based calculation
public static FormatBandwidth ( double bitsPerSecond ) : string
bitsPerSecond double /// Bits per second. ///
Результат string
        public static string FormatBandwidth(double bitsPerSecond)
        {
            if (bitsPerSecond >= (1000d*1000d*1000d*1000d))
                return String.Format("{0:##.##} TBit/s", Math.Round(bitsPerSecond / (1000d*1000d*1000d*1000d), 1));
            else if (bitsPerSecond >= (1000d*1000d*1000d))
                return String.Format("{0:##.##} GBit/s", Math.Round(bitsPerSecond / (1000d*1000d*1000d), 1));
            else if (bitsPerSecond >= (1000d*1000d))
                return String.Format("{0:##.##} MBit/s", Math.Round(bitsPerSecond / (1000d*1000d), 1));
            else if (bitsPerSecond >= 1000d)
                return String.Format("{0:##.##} KBit/s", Math.Round(bitsPerSecond / 1000d, 1));
            else
                return bitsPerSecond.ToString() + " Bit/s";
        }

Same methods

Utils::FormatBandwidth ( long bitsPerSecond ) : string