You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
33 lines
912 B
33 lines
912 B
2 years ago
|
namespace Znyc.Cloudcar.Admin.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);
|
||
|
}
|
||
|
|
||
|
if (value >= 1000 && value < 1000000)
|
||
|
{
|
||
|
return string.Format("{0:F2} Kb", (double)value / 1024);
|
||
|
}
|
||
|
|
||
|
if (value >= 1000 && value < 1000000000)
|
||
|
{
|
||
|
return string.Format("{0:F2} M", (double)value / 1048576);
|
||
|
}
|
||
|
|
||
|
return string.Format("{0:F2} G", (double)value / 1073741824);
|
||
|
}
|
||
|
}
|
||
|
}
|