111,126
社区成员
发帖
与我相关
我的任务
分享string GetReadableFileSize(long fileSize) {
long s = size;
string[] format = new string[] { "{0} bytes", "{0} KB", "{0} MB", "{0} GB", "{0} TB", "{0} PB", "{0} EB", "{0} ZB", "{0} YB" };
int i = 0;
while (i < format.Length - 1 && s >= 1024) {
s = (long)((long)100 * s / (long)1024) / (long)100.0;
i++;
}
return string.Format(format[i], s.ToString("###,###,###.##"));
}