我的客户申请与全球合作框架服务连接,我从服务器获得文件尺寸,作为<代码>long。 然后,我将其在客户中的数值改为string
。 ∗∗∗∗∗∗∗∗
The application gets too many files sizes every time user changes the current directory path.
www.un.org/chinese/ecosoc 如果我把数值转换为string
form from the WCF Service app 然后作为<条码>将其退回客户。 或者,我只是将体积作为<条码>长期条码>值,让客户将其转换成<条码>,<> 格式
In other way which value take more bytes in the memory:
long size = 55050240;
string size = "52.5 MB";
long large_size = 56371445760;
string large_size = "52.5 GB";
UPDATE:
我使用这种方法将长期价值转换为一种扼制格式:
private string ConvertUnit(long source)
{
const int byteConversion = 1024;
double bytes = Convert.ToDouble(source);
if (bytes >= Math.Pow(byteConversion, 3)) //GB Range
{
return string.Concat(Math.Round(bytes / Math.Pow(byteConversion, 3), 2), " GB");
}
else if (bytes >= Math.Pow(byteConversion, 2)) //MB Range
{
return string.Concat(Math.Round(bytes / Math.Pow(byteConversion, 2), 2), " MB");
}
else if (bytes >= byteConversion) //KB Range
{
return string.Concat(Math.Round(bytes / byteConversion, 2), " KB");
}
else //Bytes
{
return string.Concat(bytes, " Bytes");
}
}
www.un.org/spanish/ecosoc 简短问题: 需要更多的记忆<代码> 价值或long
值?