I need to format a decimal field in a .csv file that I write with the LINQtoCSV library of this format: 95.43000000
for that format 95.43
. I map this field like this:
[CsvColumn(Name = "Price", OutputFormat = "C")]
public decimal? Price { get; set; }
which gives me a monetary value $95.43
. I load the data so that it is brought up to the 6th decimal place, but I need to eliminate strings of zeros at the end:
Price = Math.Round(AdjustPrice(x.Price, x.Ticker), 6)
Anyone can help?