I'm using LiveChart
of wpf, and I want instantiate a list of Decimal
with 30 values (just as space as an array), actually I did:
public SeriesCollection MonthProfit {get;set;} = new SeriesCollection();
int i = 0;
MonthProfit[0].Values = new ChartValues<decimal>();
MonthProfit[0].Values[i] = 25;
but I get:
Index out of range
how can I define 30 values inside the index 0
?
It looks to me like you could use the ChartValues
constructor that accepts an IEnumerable<T>
:
MonthProfit[0].Values = new ChartValues<decimal>(Enumerable.Repeat(0m, 30));