# C1.LiveLinq.IndexedQueryExtensions.SelectMany

## Content

<div class="doc-site-dotnet-api-container">



<h1 id="C1_LiveLinq_IndexedQueryExtensions_SelectMany_" data-uid="C1.LiveLinq.IndexedQueryExtensions.SelectMany*">SelectMany Method
</h1>
<div class="markdown level0 summary"></div>
<div class="markdown level0 conceptual"></div>



<a id="C1_LiveLinq_IndexedQueryExtensions_SelectMany_" data-uid="C1.LiveLinq.IndexedQueryExtensions.SelectMany*"></a>
<h4 id="C1_LiveLinq_IndexedQueryExtensions_SelectMany__3_C1_LiveLinq_Indexing_IIndexedSource___0__System_Linq_Expressions_Expression_System_Func___0_System_Collections_Generic_IEnumerable___1____System_Linq_Expressions_Expression_System_Func___0___1___2___" data-uid="C1.LiveLinq.IndexedQueryExtensions.SelectMany``3(C1.LiveLinq.Indexing.IIndexedSource{``0},System.Linq.Expressions.Expression{System.Func{``0,System.Collections.Generic.IEnumerable{``1}}},System.Linq.Expressions.Expression{System.Func{``0,``1,``2}})">SelectMany&lt;TSource, TCollection, TResult&gt;(IIndexedSource&lt;TSource&gt;, Expression&lt;Func&lt;TSource, IEnumerable&lt;TCollection&gt;&gt;&gt;, Expression&lt;Func&lt;TSource, TCollection, TResult&gt;&gt;)</h4>
<div class="markdown level1 summary"><p>Projects each element of a collection to a sequence of collections, flattens the resulting collections into one collection,
and invokes a result selector function on each element therein.</p>
</div>
<div class="markdown level1 conceptual"></div>
<h5 class="declaration">Declaration</h5>
<div class="codewrapper">
  <pre><code class="lang-csharp hljs">public static IIndexedSource&lt;TResult&gt; SelectMany&lt;TSource, TCollection, TResult&gt;(this IIndexedSource&lt;TSource&gt; source, Expression&lt;Func&lt;TSource, IEnumerable&lt;TCollection&gt;&gt;&gt; collectionSelector, Expression&lt;Func&lt;TSource, TCollection, TResult&gt;&gt; resultSelector)</code></pre>
</div>
<div class="codewrapper">
  <pre><code class="lang-vbnet hljs">Public Shared Function SelectMany(Of TSource, TCollection, TResult)(source As IIndexedSource(Of TSource), collectionSelector As Expression(Of Func(Of TSource, IEnumerable(Of TCollection))), resultSelector As Expression(Of Func(Of TSource, TCollection, TResult))) As IIndexedSource(Of TResult)</code></pre>
</div>
<h5 class="parameters">Parameters</h5>
<table class="table table-bordered table-condensed">
  <thead>
    <tr>
      <th>Type</th>
      <th>Name</th>
      <th>Description</th>
    </tr>
  </thead>
  <tbody>
    <tr>
      <td><a class="xref" href="C1.LiveLinq.Indexing.IIndexedSource-1.html">IIndexedSource</a>&lt;TSource&gt;</td>
      <td><span class="parametername">source</span></td>
      <td><p>A collection of values to project.</p>
</td>
    </tr>
    <tr>
      <td><a class="xref" href="https://learn.microsoft.com/dotnet/api/system.linq.expressions.expression-1">Expression</a>&lt;<a class="xref" href="https://learn.microsoft.com/dotnet/api/system.func-2">Func</a>&lt;TSource, <a class="xref" href="https://learn.microsoft.com/dotnet/api/system.collections.generic.ienumerable-1">IEnumerable</a>&lt;TCollection&gt;&gt;&gt;</td>
      <td><span class="parametername">collectionSelector</span></td>
      <td><p>A transform function to apply to each element of the input collection.</p>
</td>
    </tr>
    <tr>
      <td><a class="xref" href="https://learn.microsoft.com/dotnet/api/system.linq.expressions.expression-1">Expression</a>&lt;<a class="xref" href="https://learn.microsoft.com/dotnet/api/system.func-3">Func</a>&lt;TSource, TCollection, TResult&gt;&gt;</td>
      <td><span class="parametername">resultSelector</span></td>
      <td><p>A transform function to apply to each element of the intermediate sequence.</p>
</td>
    </tr>
  </tbody>
</table>
<h5 class="returns">Returns</h5>
<table class="table table-bordered table-condensed">
  <thead>
    <tr>
      <th>Type</th>
      <th>Description</th>
    </tr>
  </thead>
  <tbody>
    <tr>
      <td><a class="xref" href="C1.LiveLinq.Indexing.IIndexedSource-1.html">IIndexedSource</a>&lt;TResult&gt;</td>
      <td><p>An <a class="xref" href="C1.LiveLinq.Indexing.IIndexedSource-1.html">IIndexedSource&lt;TResult&gt;</a> whose elements are the result of invoking the one-to-many transform function
<i>collectionSelector</i> on each element of <i>source</i> and then mapping each of those sequence elements and their
corresponding source element to a result element.</p>
</td>
    </tr>
  </tbody>
</table>
<h5 class="typeParameters">Type Parameters</h5>
<table class="table table-bordered table-condensed">
  <thead>
    <tr>
      <th>Name</th>
      <th>Description</th>
    </tr>
  </thead>
  <tbody>
    <tr>
      <td><span class="parametername">TSource</span></td>
      <td><p>The type of the elements of <i>source</i>.</p>
</td>
    </tr>
    <tr>
      <td><span class="parametername">TCollection</span></td>
      <td><p>The type of the intermediate elements collected by <i>collectionSelector</i>.</p>
</td>
    </tr>
    <tr>
      <td><span class="parametername">TResult</span></td>
      <td><p>The type of the elements of the resulting collection.</p>
</td>
    </tr>
  </tbody>
</table>


<a id="C1_LiveLinq_IndexedQueryExtensions_SelectMany_" data-uid="C1.LiveLinq.IndexedQueryExtensions.SelectMany*"></a>
<h4 id="C1_LiveLinq_IndexedQueryExtensions_SelectMany__2_C1_LiveLinq_Indexing_IIndexedSource___0__System_Linq_Expressions_Expression_System_Func___0_System_Collections_Generic_IEnumerable___1____" data-uid="C1.LiveLinq.IndexedQueryExtensions.SelectMany``2(C1.LiveLinq.Indexing.IIndexedSource{``0},System.Linq.Expressions.Expression{System.Func{``0,System.Collections.Generic.IEnumerable{``1}}})">SelectMany&lt;TSource, TResult&gt;(IIndexedSource&lt;TSource&gt;, Expression&lt;Func&lt;TSource, IEnumerable&lt;TResult&gt;&gt;&gt;)</h4>
<div class="markdown level1 summary"><p>Projects each element of a collection to a sequence of collections and flattens the resulting collections into one collection.</p>
</div>
<div class="markdown level1 conceptual"></div>
<h5 class="declaration">Declaration</h5>
<div class="codewrapper">
  <pre><code class="lang-csharp hljs">public static IIndexedSource&lt;TResult&gt; SelectMany&lt;TSource, TResult&gt;(this IIndexedSource&lt;TSource&gt; source, Expression&lt;Func&lt;TSource, IEnumerable&lt;TResult&gt;&gt;&gt; selector)</code></pre>
</div>
<div class="codewrapper">
  <pre><code class="lang-vbnet hljs">Public Shared Function SelectMany(Of TSource, TResult)(source As IIndexedSource(Of TSource), selector As Expression(Of Func(Of TSource, IEnumerable(Of TResult)))) As IIndexedSource(Of TResult)</code></pre>
</div>
<h5 class="parameters">Parameters</h5>
<table class="table table-bordered table-condensed">
  <thead>
    <tr>
      <th>Type</th>
      <th>Name</th>
      <th>Description</th>
    </tr>
  </thead>
  <tbody>
    <tr>
      <td><a class="xref" href="C1.LiveLinq.Indexing.IIndexedSource-1.html">IIndexedSource</a>&lt;TSource&gt;</td>
      <td><span class="parametername">source</span></td>
      <td><p>A collection of values to project.</p>
</td>
    </tr>
    <tr>
      <td><a class="xref" href="https://learn.microsoft.com/dotnet/api/system.linq.expressions.expression-1">Expression</a>&lt;<a class="xref" href="https://learn.microsoft.com/dotnet/api/system.func-2">Func</a>&lt;TSource, <a class="xref" href="https://learn.microsoft.com/dotnet/api/system.collections.generic.ienumerable-1">IEnumerable</a>&lt;TResult&gt;&gt;&gt;</td>
      <td><span class="parametername">selector</span></td>
      <td><p>A transform function to apply to each element.</p>
</td>
    </tr>
  </tbody>
</table>
<h5 class="returns">Returns</h5>
<table class="table table-bordered table-condensed">
  <thead>
    <tr>
      <th>Type</th>
      <th>Description</th>
    </tr>
  </thead>
  <tbody>
    <tr>
      <td><a class="xref" href="C1.LiveLinq.Indexing.IIndexedSource-1.html">IIndexedSource</a>&lt;TResult&gt;</td>
      <td><p>An <a class="xref" href="C1.LiveLinq.Indexing.IIndexedSource-1.html">IIndexedSource&lt;TResult&gt;</a> whose elements are the result of invoking the one-to-many transform function
on each element of the source collection.</p>
</td>
    </tr>
  </tbody>
</table>
<h5 class="typeParameters">Type Parameters</h5>
<table class="table table-bordered table-condensed">
  <thead>
    <tr>
      <th>Name</th>
      <th>Description</th>
    </tr>
  </thead>
  <tbody>
    <tr>
      <td><span class="parametername">TSource</span></td>
      <td><p>The type of the elements of <i>source</i>.</p>
</td>
    </tr>
    <tr>
      <td><span class="parametername">TResult</span></td>
      <td><p>The type of the elements of the sequence returned by <i>selector</i>.</p>
</td>
    </tr>
  </tbody>
</table>
</div>
