我有很多小数,每个小数都不同:
decimal quantity = Decimal.Round(item.Quantity.Value, 2,
MidpointRounding.AwayFromZero);
decimal difference = Decimal.Round(quantity * eva, 0,
MidpointRounding.AwayFromZero);
绑定到 UI 时,我转换为这样的字符串:
string Quantity = quantity.ToString("G", CultureInfo.InvariantCulture);
string Difference = difference.ToString("G", CultureInfo.InvariantCulture);
是否有一种通用方法可以为千位分隔符插入逗号,同时保持原始小数舍入相同?