Is there a better way to write this function that will add a comma to a number?
private static string FormatNumber(decimal? number)
{
if (!number.HasValue)
{
return string.Empty;
}
// use the different formatter for long numbers
return number > 99999 ? $"{number.Value:#,###.##}" : $"{number.Value:G29}";
}