English | 简体中文 | 繁體中文 | Русский язык | Français | Español | Português | Deutsch | 日本語 | 한국어 | Italiano | بالعربية

LINQ into Keyword

Using the 'into' keyword in LINQ queries can form a group or continue querying after the select clause.

var teenAgerStudents = from s in studentList
    where s.age > 12 && s.age < 20
    select s
        into teenStudents
        where teenStudents.StudentName.StartsWith("B")
        select teenStudents;

In the above query, the 'into' keyword introduces a new range variable teenStudents, so the first range variable s is out of scope. You can use the new range variable to write further queries after the 'into' keyword.

'into' Keyword in VB.Net is used for grouping.

Example: 'into' Keyword in VB.Net LINQ
Dim groupQuery = From s In studentList
                 Group By s.Age Into Group