No, that will fail with an InvalidOperationException
. I'm sure you're just catching the exception in the calling code. It's very easy to show - just take your exact code and put it into a short but complete sample:
using System.Collections.Generic;
using System.Linq;
class Test
{
static void Main()
{
var emptyList = new List<string>();
var aha = emptyList.Where(i => i == "four");
var props = aha.First();
}
}
Result:
Unhandled Exception: System.InvalidOperationException: Sequence contains no elements
at System.Linq.Enumerable.First[TSource](IEnumerable`1 source)
at Test.Main()
So your next step is to work out why you're not seeing the exception - and we can't help with that.