With extension methods, we can write handy LINQ operators which solve generic problems.
I want to hear which methods or overloads you are missing in the System.Linq
namespace and how you implemented them.
Clean and elegant implementations, maybe using existing methods, are preferred.
CountUpTo
FirstOrDefault with a default value specified
Order
Shuffle
EDIT: It seems there are several issues with the above implementation. Here is an improved version based @LukeH's code and comments from @ck and @Strilanc.
Window
Enumerates arrays ("windows") with the length of
size
containing the most current values.{ 0, 1, 2, 3 }
becomes to{ [0, 1], [1, 2], [2, 3] }
.I am using this for example to draw a line graph by connecting two points.
Append & Prepend