Skip to content

Instantly share code, notes, and snippets.

@DylanLacey
Created August 11, 2011 06:53
Show Gist options
  • Save DylanLacey/1139045 to your computer and use it in GitHub Desktop.
Save DylanLacey/1139045 to your computer and use it in GitHub Desktop.
Broken LINQing
var returnShift =
All().Aggregate(
(x, y) =>
(x.start.Ticks - desiredStartTime.Ticks) < (y.start.Ticks - desiredStartTime.Ticks) ? x : y);
Error message:
Expression of type 'System.Collections.Generic.IEnumerable`1[ShiftyEyes.Model.Shift]' cannot be used for parameter of type 'System.Linq.IQueryable`1[ShiftyEyes.Model.Shift]' of method 'ShiftyEyes.Model.Shift Aggregate[Shift](System.Linq.IQueryable`1[ShiftyEyes.Model.Shift], System.Linq.Expressions.Expression`1[System.Func`3[ShiftyEyes.Model.Shift,ShiftyEyes.Model.Shift,ShiftyEyes.Model.Shift]])'
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment