I\'m trying to prepare data for a graph using LINQ.
The problem that i cant solve is how to calculate the \"difference to previous.
the result I expect is <
Use index to get previous object:
var LinqList = list.Select( (myObject, index) => new { ID = myObject.ID, Date = myObject.Date, Value = myObject.Value, DiffToPrev = (index > 0 ? myObject.Value - list[index - 1].Value : 0) } );