/// <summary> Baitid KB, MB, GB, TB ühikuteks intelligentne teisendus /// </summary> <param name="len"></param> /// <returns></returns> avalik staatiline string ConvertBytes (pikk len) { string[] suurused = { "Baitid", "KB", "MB", "GB", "TB" }; int järk = 0; samal ajal (len >= 1024 && järjestus + 1 < suurust. Pikkus) //{ tellimus++; len = len / 1024; //} return String.Format("{0:0.##} {1}", len, sizes[order]); double leng = Convert.ToDouble(len); string[] suurused = { "Baitid", "KB", "MB", "GB", "TB" }; int järk = 0; samal ajal (leng >= 1024 && järjestus + 1 < suurust. Pikkus) { tellimus++; leng = leng / 1024; } return String.Format("{0:0.##} {1}", leng, sizes[order]); } |