/**//// <summary>
/// 計算字節大小函數,傳入一以字節為單位的值。
/// </summary>
/// <param name="size">要計算的字節大小,單位為“字節”</param>
/// <returns>計算後的大小值</returns>
public string CountSize(long size)
...{
const double baseKB = 1024.00, baseMB = 1024 * 1024.00;
string strSize = "";
if(size < baseKB)
...{
strSize = size.ToString() + " B";
}
if(size > baseKB && size < baseMB)
...{ strSize = string.Format("{0:0.##} KB",(size/baseKB));
}
else if(size > baseMB)
...{
strSize = string.Format("{0:0.##} MB",(size/baseMB));
}
return strSize;
}