我在我的程序的代码块中收到此错误.我正在使用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]);
}
Run Code Online (Sandbox Code Playgroud)
默认参数在.Net 2中不可用.
它们只在.Net 4.0中可用:
http://msdn.microsoft.com/en-us/library/dd264739.aspx
| 归档时间: |
|
| 查看次数: |
899 次 |
| 最近记录: |