Skip to content

Instantly share code, notes, and snippets.

@TimGeyssens
Created August 24, 2020 11:47
Show Gist options
  • Save TimGeyssens/94e74f161c6e572f92755bbcca699646 to your computer and use it in GitHub Desktop.
Save TimGeyssens/94e74f161c6e572f92755bbcca699646 to your computer and use it in GitHub Desktop.
using System.Linq;
static public class IEnumerableHelper
{
static public Object<T> TakeFirst<T>(this IEnumerable<T> items)
{
return items.Take(1).First();
}
}
@stefankip
Copy link

Why not go with items.First()?

@TimGeyssens
Copy link
Author

Haha yes, that would be the correct option :) was just trying to help out Chriztianand show him how to do an extension method...

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment