public static string ToShortSizeInBytesString(long bytes)
{
const int kb = 1024;
const int mb = kb*kb;
const int gb = mb*kb;
const string format = "{0} {1}";
if (bytes < kb)
if (bytes >= gb)
return string.Format(format, Math.Round(bytes / (double)gb, 1), "Gb");
if (bytes >= mb)
return string.Format(format, Math.Round(bytes / (double)mb, 1), "Mb");
if (bytes >= kb)
return string.Format(format, Math.Round(bytes / (double)kb, 1), "Kb");
return string.Format(format, bytes, "bytes");
}