|
<< Click to Display Table of Contents >> Formatar tamanho de arquivos |
![]() ![]()
|
public static string GetSizeHumanRedable(long bytes)
{
string[] suf = {"bytes", "Kb", "Mb", "Gb", "Tb", "Pb"};
int place = Convert.ToInt32(Math.Floor(Math.Log(bytes, 1024)));
double num = Math.Round(bytes / Math.Pow(1024, place), 1);
return num.ToString() + "<i>" + suf[place] + "</i>";
}