Linq By Example

First

Returns the first element of an enumerable, but throws an InvalidOperationException is no element is found.

Multiple Matching Elements

If multiple elements match the predicate, only the first will be returned. This is in contrast to Single/SingleOrDefault which instead will throw an exception if more than one element is found.

Because the First LINQ statement immediately returns on the first found element, performance can vary depending where in the list the element is. If the element is the very first item vs being the last item etc. Again, this is in contrast to Single/SingleOrDefault which will continue searching through the entire list to find a second matching item.
    
using System;
using System.Collections.Generic;
using System.Linq;

var personList = new List
{
    new Person
    {
        FirstName = "John",
        LastName = "Smith"
    }, 
    new Person
    {
        FirstName = "Jane", 
        LastName = "Doe"
    }, 
    new Person
    {
        FirstName = "John", 
        LastName = "Doe"
    }
};

var firstJohn = personList.First(x => x.FirstName == "John");
Console.WriteLine($"The first John found has a last name of {firstJohn.LastName}");

class Person
{
    public string FirstName { get; set; }
    public string LastName { get; set; }
}

  

No Matching Elements

If no elements match the predicate, then an System.InvalidOperation exception will be thrown with the message 'Sequence contains no matching element'. This is in contrast to FirstOrDefault which will return a default(T) value if no element is found.
    
using System;
using System.Collections.Generic;
using System.Linq;

var personList = new List
{
    new Person
    {
        FirstName = "John",
        LastName = "Smith"
    }
};

var firstJohn = personList.First(x => x.FirstName == "Amy"); //Throws an System.InvalidOperationException

class Person
{
    public string FirstName { get; set; }
    public string LastName { get; set; }
}