Hi,
Based on my understanding, it is as the documentation says. This is due to a quality of the object oriented programming languages named Polymorphism.
Basically, the IQueryable interface inherits from the IEnumerable interface. This allows you to sent a reference of type IEnumerable to an IQueryable implementation, return an IQueryable"as it was" an IEnumerable, etc. Hence, without the ToList invocation (which returns a List which is an IEnumerable implementation), an IQueryable would be returned instead "masked" as an IEnumerable.
When storing an IQueryable using a reference of type IEnumerable you can invoke its methods like you would on an IEnumerable but the logic that will be executed is the one defined in the IQueryable implementation, e. i. the behavior of the object will still be the one of an IQueryable.
The same applies to the IEnumerable extension methods because, basically, an extension method is an static method that uses the original methods of the object to work.
You can find more information about Polimorphism in the following MSDN article:
Regards,
Damian Cherubini
http://blogs.southworks.net/dcherubini
Based on my understanding, it is as the documentation says. This is due to a quality of the object oriented programming languages named Polymorphism.
Basically, the IQueryable interface inherits from the IEnumerable interface. This allows you to sent a reference of type IEnumerable to an IQueryable implementation, return an IQueryable"as it was" an IEnumerable, etc. Hence, without the ToList invocation (which returns a List which is an IEnumerable implementation), an IQueryable would be returned instead "masked" as an IEnumerable.
When storing an IQueryable using a reference of type IEnumerable you can invoke its methods like you would on an IEnumerable but the logic that will be executed is the one defined in the IQueryable implementation, e. i. the behavior of the object will still be the one of an IQueryable.
The same applies to the IEnumerable extension methods because, basically, an extension method is an static method that uses the original methods of the object to work.
You can find more information about Polimorphism in the following MSDN article:
Regards,
Damian Cherubini
http://blogs.southworks.net/dcherubini