Skip to content

Instantly share code, notes, and snippets.

@dance2die
Created April 14, 2018 21:07
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save dance2die/a3c27c88d4bc36e07496ab1c69701dfe to your computer and use it in GitHub Desktop.
Save dance2die/a3c27c88d4bc36e07496ab1c69701dfe to your computer and use it in GitHub Desktop.
private static void SkipDemo(List<Order> orders)
{
var lastTwoOrders1 = orders.Skip(orders.Count - 2);
PrintHeaderFooter("Last Two Orders - Skip", () => PrintOrders(lastTwoOrders1, indentBy), indentBy);
var lastTwoOrders2 = orders.SkipWhile((order, index) => index < orders.Count - 2);
PrintHeaderFooter("Last Two Orders - SkipWhile", () => PrintOrders(lastTwoOrders2, indentBy), indentBy);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment