Advertisement
Guest User

Untitled

a guest
Mar 29th, 2017
50
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.49 KB | None | 0 0
  1. public class PlanesLogRow
  2. {
  3. public DateTime ArriveDate;
  4. public string Origin;
  5. public string Destination;
  6. }
  7.  
  8. var rez2 = planes.SelectMany(p => new[] {
  9. new { Airport = p.Origin, IsOrigin = true },
  10. new { Airport = p.Destination, IsOrigin = false }
  11. })
  12. .GroupBy(x => x.Airport)
  13. .Select(g => new
  14. {
  15. Airport = g.Key,
  16. LeftCount = g.Count(x => x.IsOrigin),
  17. ArrivedCount = g.Count(x => !x.IsOrigin)
  18. });
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement