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 <
In C#4 you can use the Zip method in order to process two items at a time. Like this:
var list1 = list.Take(list.Count() - 1); var list2 = list.Skip(1); var diff = list1.Zip(list2, (item1, item2) => ...);