Yuebon.NetCore/Yuebon.Commons/Extend/ExtInt.cs
(完整代码) 954Bnamespace Yuebon.Commons.Extend
{
/// <summary>
/// 文件大小,较小的文件
/// </summary>
public static class ExtInt
{
/// <summary>
/// 显示文件大小,X Byte、x Kb、xM、xG
/// </summary>
/// <param name="value"></param>
/// <returns></returns>
public static string ToDisplayFileSize(this int value)
{
if (value < 1000)
{
return string.Format("{0} Byte", value);
}
else if (value >= 1000 && value < 1000000)
{
return string.Format("{0:F2} Kb", ((double)value) / 1024);
}
else if (value >= 1000 && value < 1000000000)
{
return string.Format("{0:F2} M", ((double)value) / 1048576);
}
else
{
return string.Format("{0:F2} G", ((double)value) / 1073741824);
}
}
}
}
24 小时内免费解锁 3 个项目,之后 1 算力/个。 规则说明
AI 解读 AI
登录后可用,每次 10 算力,解读结果公开显示在下面。
还没有人解读过这个文件。