Can I use LINQ to retrieve only "on change" values? -
What I want to be able to do is build a LINQ query that retrieves some value from some daters when I Here's an example for a change in a field example:
Overview Time Temporary Time ------------- ---- ------ Cloud Thunderstorms 15.0 3:00 AM Cloudy 16.5 hrs Thursday 16:00 pm Thunderstorm with thunderstorms 29 nights storm-water with thunderstorm 29 pm Thunderstorm with thunderstorm They feel like -10 > I only want to retrieve the entries, when the observation from the previous one was changed, the result would be: cloudy will remain 15.0 3:00 AM Sunny 19pm 3:30 Partly Cloudy Partly Cloudy 16.5 3:20 Cloudy Cloudy 16.0 4:00 AM Sunrise 17.5 3:45 PM
Currently this code repeats through databar and Comparisons and produces results, but it does not To test was hoping to use LINQ.
What I would like to do, is something like this:
But that does not work - and does not compile because it tries to use the variable 'weatherstuff' before it is declared.
Do I want to be done with LINQ? I did not get such a question which is here, but could remember it.
You can use the IEnumerable extension which takes an index.
Var all = ds.Tables [0] .Asnumerable (); Var weatherStuff = all.Where ((w, i) => I == 0 || w.Field & lt; string> ("Overview")! = All.ElementAt (i-1) .field & Lt; string & gt; ("overview");
Comments
Post a Comment