Skip to content

Instantly share code, notes, and snippets.

@wheeliechamp
Last active June 2, 2016 15:36
Show Gist options
  • Save wheeliechamp/1231c0361f0f5cc7b0d27d0cbf4cf3c3 to your computer and use it in GitHub Desktop.
Save wheeliechamp/1231c0361f0f5cc7b0d27d0cbf4cf3c3 to your computer and use it in GitHub Desktop.
using System;
using System.Linq;
using System.Collections.Generic;
class Program
{
static void Main(string[] args)
{
var num = Enumerable.Range(-5, 6);
Console.WriteLine(num.FirstOrDefault(item => item < 1));
Console.WriteLine(num.LastOrDefault(item => item < 2));
Console.WriteLine(num.Where(item => item < 0).ElementAt(2));
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment