I need to create an array from data I get form my API. The data needs to be in the object Entry
which I get from the MicroCharts Library.
error is: Index was outside the bounds of the array.
on the 2nd line.
the most this is one of my tries:
var entries = new[]{ new Entry(2) { } };
entries[2]=( new Entry(3) { });
for (int i = 0; i < _CoinHistory.Count(); i++)
{
var price_float = float.Parse(_CoinHistory[0].price_btc);
entries[i] = new Entry(price_float) { };
}
the hardcoded part that works is this:
var entries = new[]
{
new Entry(200)
{
},
new Entry(400)
{
},
new Entry(-100)
{
}
};
edit:Both the answer from zaitsman as the answer from PiotrWolkowski work. just like the linq way.