This method return string but let's say i want to convert two variables of sizes using this method. for example :
var newSize = info.Length;
var oldsize = dic[e.FullPath];
var size = SizeSuffix(newSize);
var oldies = SizeSuffix(oldsize);
but instead making each time a new variable maybe it will be better to do something like :
var Sizes = SizeSuffix(newSize, oldsize);
and if i want to add more for example
var Sizes = SizeSuffix(newSize, oldsize, t1, t2, t3);
and then using it like :
Sizes[0] and Sizes[1]....and so on.
static string SizeSuffix(Int64 value)
{
if (value < 0) { return "-" + SizeSuffix(-value); }
int i = 0;
decimal dValue = (decimal)value;
while (Math.Round(dValue / 1024) >= 1)
{
dValue /= 1024;
i++;
}
return string.Format("{0:n1} {1}", dValue, SizeSuffixes[i]);
}