我在我的程序的以下代码块中收到此错误。我正在将 c# 与 .net 2.0 一起使用。它在代码的第一行中以小数 = 2显示此错误。请帮忙
private string formatSizeBinary(Int64 size, Int32 decimals = 2)
{
string[] sizes = { "Bytes", "KB", "MB", "GB", "TB", "PB", "EB", "ZB", "YB" };
double formattedSize = size;
Int32 sizeIndex = 0;
while (formattedSize >= 1024 & sizeIndex < sizes.Length)
{
formattedSize /= 1024;
sizeIndex += 1;
}
return string.Format("{0} {1}", Math.Round(formattedSize, decimals).ToString(), sizes[sizeIndex]);
}