The SelectMany operator is useful when working with a sequence of sequences.

SelectMany collapses many elements into a single collection. The resulting collection is of another element type. We specify how an element is transformed into a collection of other elements. The SQL equivalent of SelectMany is INNER JOIN, LEFT OUTER JOIN and CROSS JOIN.

For example, the following LINQ query shows how to join Customers and Orders table.

You must be wondering about the difference between the Select and SelectMany operators. Both the methods are used to produce a result value from a source of values.

However, the difference lies in the result value. The Select() is used to produce one result value for every source value. The result value is a collection that has the same number of elements from the query.

In contrast, the SelectMany() produces a single result that contains a concatenated collection from the query.