Profile Picture

NDataSeries .FillFromEnumerable with Linq expression throws NotImplementException

Posted By Marcus Förster 8 Years Ago

NDataSeries .FillFromEnumerable with Linq expression throws...

Author
Message
Marcus Förster
Problem Posted 8 Years Ago
View Quick Profile
Forum Newbie

Forum Newbie (0 reputation)Forum Newbie (0 reputation)Forum Newbie (0 reputation)Forum Newbie (0 reputation)Forum Newbie (0 reputation)Forum Newbie (0 reputation)Forum Newbie (0 reputation)Forum Newbie (0 reputation)Forum Newbie (0 reputation)

Group: Forum Members
Last Active: 2 Years Ago
Posts: 1, Visits: 35
It looks like NDataSeries<T>.FillFromEnumerable calls Reset on its argument.
The IEnumerable object returned by System.Linq.Enumerable.Select (and possibly other Linq methods) does not implement Reset, and throws NotImplementedException.

To reproduce:
new NDataSeriesDouble().FillFromEnumerable(new double[] { 0, 1 }.Select(x => x));

Expected behavior: Fills the series with the values 0 and 1.
Observed behavior: Throws NotImplementedException.



Tags
Nevron Support
Posted 8 Years Ago
View Quick Profile
Supreme Being

Supreme Being (4,435 reputation)Supreme Being (4,435 reputation)Supreme Being (4,435 reputation)Supreme Being (4,435 reputation)Supreme Being (4,435 reputation)Supreme Being (4,435 reputation)Supreme Being (4,435 reputation)Supreme Being (4,435 reputation)Supreme Being (4,435 reputation)

Group: Forum Members
Last Active: Last Week
Posts: 3,054, Visits: 4,009
Hi Marcus,

Yes that's correct - it does call Reset internally just to make sure the enumerator starts from the first item. We have removed the Reset and this problem will not appear in future SP's. For the time being you can use the following code to workaround the
NDataSeriesDouble dataSeries = new NDataSeriesDouble();

IEnumerator enumerator = new double[] { 0, 1 }.Select(x => x).GetEnumerator();
while (enumerator.MoveNext())
{
dataSeries.Add(enumerator.Current);
}

Hope this helps - let us know if you meet any problems or have any questions.



Best Regards,
Nevron Support Team





Similar Topics


Reading This Topic