This works just fine. We don’t specify the type of the value returned from the query expression, but we know that it’s something that we can iterate on, so we just use var for the result and then var again in the foreach.

The difficulty comes when someone else is going to modify this code. The query actually returns an enumerable list of strings. But reading the code, you might make the mistake of thinking that it returns a list of dogs.

Or by giving it a more comprehensively descriptive variable name – i.e. oldDogsNames instead of oldDogs.

IMHO, variable naming is the most under-appreciated element in contributing to one’s code maintainability. Don’t get me wrong, now. I’m not advocating getting all crazy-like and using “lang_Hungarian abbr_Notation”.