I am trying to use the new C# 7 pattern matching feature in this line of code
if (Customers.SingleOrDefault(x => x.Type == CustomerType.Company) is Customer customer)
{
...
}
But for some reason Resharper/Visual Studio 2017 is giving me a warning under is Customer with the following message
The source expression is always of pattern's type, matches on all non-null values
But customer can also be null right? Can anyone please explain to me why it's given this warning?