I know that Entity Framework queries can't contain arrays. For example, this will fail:
var myRow = DbContext.myTable.Single(d => d.Property1 == myArray[0].Property1);
But if I assign that element into a variable first like this:
var property1 = myArray[0].Property1;
var myRow = DbContext.myTable.Single(d => d.Property1 == property1);
Then it works. Why can't the compiler do this for us? It already makes optimizations and affords us shortcuts via syntactic sugar in many other circumstances. Is there a source of ambiguity that would prevent the compiler from copying the array element into a temporary variable in the background? Or some other reason?