LINQ | Projection Operator | SelectMany
In LINQ, projection is an operation which converts an object into the new form which holds only those properties which will be subsequently used. By using projection, a developer can create a new type which is built from each object. You are allowed to project property and conduct mathematical function on it, and you can also project the original object without transforming it.
In LINQ, the following projection operations are available:
The SelectMany operator returns sequences of values which are based on the transformation function and then make them into one sequence. Or in other words, we can say, SelectMany operator is used when you want to select values from the multiple collections or if you want a result from the list of the lists and wants to display into a single sequence.
SelectMany in Query Syntax: In Query Syntax, the working of SelectMany operator is achieved by using multiple from clause. As shown in the below example.
SelectMany in Method Syntax: The SelectMany method is present in both the Queryable and Enumerable class and supported by both C# and VB.Net languages.
Please Login to comment...