When querying with linq the background compiler automatically infers type information from any implementation of IEnumerable<T> as IEnumerable<anonymous type>. This gives us the IntelliSense we know and love while writing a query against a known type, without being bound to query results of which are of that type. Instead we can project onto new known types, new anonymous types, or in this case, a sub type.
Consider the following class:
In this query, only one expression has been selected, so our var query has inferred the type Person from the List<Person> implementation of IEnumerable<T>. Our IntelliSense for p looks like this:
Now lets add some inheritance:
Some new Employees to our list:
Hmm, now how do I select Employees who are active and work in sales if my IntelliSense is being driven off List<Person>?
Well, we can certainly use standard C# operators to get the job done: