O'Reilly logo

C# 5.0 Unleashed by Bart De Smet

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Continuing a Query Expression Using the into Clause

Although most query expression clauses can be followed by others immediately, there are a few notable exceptions. In particular, select and group by end a query expression because of their projective characteristic. For example:

var query = from product in products            select new { product.Name, product.Price };

Once the projection has happened, the query expression produces objects of the type used in the select clause. In this particular example, that’s an anonymous type with two properties: Name and Price. At this point, we don’t have an identifier anymore to refer to those objects: If product would still be “in scope,” we could get access to properties ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required