public static ReadableSize ( long size ) : string | ||
size | long | |
return | string |
public static string ReadableSize(long size) {
double temp = size;
var level = 0;
while (temp > 2e3) {
temp /= 1024;
level++;
}
return temp.ToString("F2") + " " + (" KMGT"[level] + "B").TrimStart();
}