一品网
  • 首页

字节b换算kb/mb/gb/tb/pb


public static string HumanReadableFilesize(double size)
{
string[] units = new string[] { "B", "KB", "MB", "GB", "TB", "PB" };
double mod = 1024.0;
int i = 0;
while (size >= mod)
{
size /= mod;
i++;
}
return Math.Round(size, 2) + units[i];
}

C

相关


C# 十六进制八进制前缀或后缀

C#中的Attribute(特性)的使用

c#小灶——9.算术运算符

c#小灶——4.注释和代码规范

c#小灶——3.输出语句

【Luogu3414】SAC#1 - 组合数

[C#] 使用递归将多条路径生成树

C#封装定时执行任务类

【C#进阶系列】30 学习总结

【C#进阶系列】10 属性

【C#进阶系列】18 特性Attribute

C# string 加号与StringBuilder .netCore3.1与 .netCore5.0速度测试

标签

一品网 冀ICP备14022925号-6