In LINQ, projection is an operation that transforms an object into a new form that often consists of only the properties which we use frequently.
There are two types of projection operators in LINQ those are
The following table shows more detail regarding projection operators in LINQ.
Operator | Description | Query Syntax |
---|---|---|
Select | This operator projects values based on transform functions. | select |
SelectMany | This operator projects sequence of values that are based on a transform function and then flattens them into one sequence | Use Multiple from Clauses |
In LINQ Select projection operator is used to select data from a collection. This LINQ select operator is same as SQL select clause.
Following is the syntax of using the LINQ select projection operator to get data from a collection.
To know more about LINQ select projection operator, check this LINQ Select Projection Operator with Example.
In LINQ SelectMany projection operator is used to select values from the collection of collection.
Following is the syntax of using the LINQ SelectMany projection operator.
To know more about LINQ SelectMany projection operator check this LINQ SelectMany Projection Operator with Example.