It is because LINQtoSQL uses Deferred Execution. It means that the evaluation of an expression is delayed until its realized value is actually required. Deferred execution can greatly improve performance
when you have to manipulate large data collections, especially in programs that contain a series of chained queries or manipulations. In the best case, deferred execution enables only a single iteration through the source collection.
When you Call the ToList() method on the expression. It returns the result of the expression immediatly. So you must call such a method.
kshyju
Member
134 Points
39 Posts
Re: Why it cannot work property without "ToList"?
Jun 03, 2012 02:00 PM|LINK
It is because LINQtoSQL uses Deferred Execution. It means that the evaluation of an expression is delayed until its realized value is actually required. Deferred execution can greatly improve performance when you have to manipulate large data collections, especially in programs that contain a series of chained queries or manipulations. In the best case, deferred execution enables only a single iteration through the source collection.
When you Call the ToList() method on the expression. It returns the result of the expression immediatly. So you must call such a method.
My flarack profile