Getting warning "The source expression is always of pattern's type, matches on all non-null values"
You're right!
ReSharper (not Visual Studio) is factually right, although I don't know why that would be a warning.
Although Customers
is a collection of Customer
, the use of SingleOrDefault
hints that the value might be null
which is not a Customer
.
And nothing says that all values coming out of Customers
are non-null
.