Advertisement
Guest User

Untitled

a guest
Apr 17th, 2014
58
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.85 KB | None | 0 0
  1. var test = new List<Sample> { new Sample("AT", "test1"),
  2. new Sample("AT", "test2") ,
  3. new Sample("AT", "test3") ,
  4. new Sample("DE", "test4") ,
  5. new Sample("DE", "test5") ,
  6. new Sample("DE", "test6") ,
  7. new Sample("AT", "test7") ,
  8. new Sample("AT", "test8") ,
  9. new Sample("AT", "test9")
  10. };
  11.  
  12.  
  13. var borderChanges = new List<Sample>();
  14. var lastCountry = "";
  15. foreach (var sample in test)
  16. {
  17. if (sample.country != lastCountry)
  18. {
  19. lastCountry = sample.country;
  20. borderChanges.Add(sample);
  21. }
  22. }
  23.  
  24. test.Where((x,idx) => idx == 0 || x.Country != test[idx - 1].Country));
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement