using System.Numerics; using GFramework.Core.Abstractions.Utility.Numeric; using GFramework.Core.Utility.Numeric; namespace GFramework.Core.Extensions; /// /// 数值显示扩展方法。 /// public static class NumericDisplayExtensions { /// /// 按指定选项将数值格式化为展示字符串。 /// public static string ToDisplayString(this T value, NumericFormatOptions? options = null) where T : INumber { return NumericDisplay.Format(value, options); } /// /// 使用默认紧凑风格将数值格式化为展示字符串。 /// public static string ToCompactString( this T value, int maxDecimalPlaces = 1, IFormatProvider? formatProvider = null) where T : INumber { return NumericDisplay.FormatCompact(value, maxDecimalPlaces, formatProvider); } }