| | | 1 | | using System.Globalization; |
| | | 2 | | |
| | | 3 | | namespace ArturRios.Data.Export.Abstractions; |
| | | 4 | | |
| | | 5 | | /// <summary>Renders a value to a stable, culture-invariant string for columnar/text output.</summary> |
| | | 6 | | public static class ValueRenderer |
| | | 7 | | { |
| | | 8 | | /// <summary>null → empty; string → itself; <see cref="IFormattable" /> → invariant culture; otherwise <see cref="ob |
| | 21 | 9 | | public static string Render(object? value) => value switch |
| | 21 | 10 | | { |
| | 1 | 11 | | null => string.Empty, |
| | 8 | 12 | | string s => s, |
| | 12 | 13 | | IFormattable f => f.ToString(null, CultureInfo.InvariantCulture), |
| | 0 | 14 | | _ => value.ToString() ?? string.Empty |
| | 21 | 15 | | }; |
| | | 16 | | } |