# C1.LiveLinq.IndexedQueryExtensions.Where

## Content

<div class="doc-site-dotnet-api-container">



<h1 id="C1_LiveLinq_IndexedQueryExtensions_Where_" data-uid="C1.LiveLinq.IndexedQueryExtensions.Where*">Where Method
</h1>
<div class="markdown level0 summary"></div>
<div class="markdown level0 conceptual"></div>



<a id="C1_LiveLinq_IndexedQueryExtensions_Where_" data-uid="C1.LiveLinq.IndexedQueryExtensions.Where*"></a>
<h4 id="C1_LiveLinq_IndexedQueryExtensions_Where__1_C1_LiveLinq_Indexing_IIndexedSource___0__System_Linq_Expressions_Expression_System_Func___0_System_Boolean___" data-uid="C1.LiveLinq.IndexedQueryExtensions.Where``1(C1.LiveLinq.Indexing.IIndexedSource{``0},System.Linq.Expressions.Expression{System.Func{``0,System.Boolean}})">Where&lt;T&gt;(IIndexedSource&lt;T&gt;, Expression&lt;Func&lt;T, bool&gt;&gt;)</h4>
<div class="markdown level1 summary"><p>Filters the source collection based on a predicate.</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;T&gt; Where&lt;T&gt;(this IIndexedSource&lt;T&gt; source, Expression&lt;Func&lt;T, bool&gt;&gt; predicate)</code></pre>
</div>
<div class="codewrapper">
  <pre><code class="lang-vbnet hljs">Public Shared Function Where(Of T)(source As IIndexedSource(Of T), predicate As Expression(Of Func(Of T, Boolean))) As IIndexedSource(Of T)</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;T&gt;</td>
      <td><span class="parametername">source</span></td>
      <td><p>An <a class="xref" href="C1.LiveLinq.Indexing.IIndexedSource-1.html">IIndexedSource&lt;T&gt;</a> to filter.</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;T, <a class="xref" href="https://learn.microsoft.com/dotnet/api/system.boolean">bool</a>&gt;&gt;</td>
      <td><span class="parametername">predicate</span></td>
      <td><p>A function to test each element for a condition.</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;T&gt;</td>
      <td><p>An <a class="xref" href="C1.LiveLinq.Indexing.IIndexedSource-1.html">IIndexedSource&lt;T&gt;</a> that contains elements from the input collection that satisfy the condition.</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">T</span></td>
      <td><p>The type of the elements of <i>source</i>.</p>
</td>
    </tr>
  </tbody>
</table>
<h5 id="C1_LiveLinq_IndexedQueryExtensions_Where__1_C1_LiveLinq_Indexing_IIndexedSource___0__System_Linq_Expressions_Expression_System_Func___0_System_Boolean____remarks">Remarks</h5>
<div class="markdown level1 remarks"><p>If an index is used to optimized performance of this operation, the resulting collection may not be in
the same order as the source collection. If you need to preserve the order, use the other overload of the <b>Where</b> operator.
It will still be optimized, albeit to a lesser degree.</p>
</div>


<a id="C1_LiveLinq_IndexedQueryExtensions_Where_" data-uid="C1.LiveLinq.IndexedQueryExtensions.Where*"></a>
<h4 id="C1_LiveLinq_IndexedQueryExtensions_Where__1_C1_LiveLinq_Indexing_IIndexedSource___0__System_Linq_Expressions_Expression_System_Func___0_System_Boolean___System_Boolean_" data-uid="C1.LiveLinq.IndexedQueryExtensions.Where``1(C1.LiveLinq.Indexing.IIndexedSource{``0},System.Linq.Expressions.Expression{System.Func{``0,System.Boolean}},System.Boolean)">Where&lt;T&gt;(IIndexedSource&lt;T&gt;, Expression&lt;Func&lt;T, bool&gt;&gt;, bool)</h4>
<div class="markdown level1 summary"><p>Filters the source collection based on a predicate, preserving the order of the source 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;T&gt; Where&lt;T&gt;(this IIndexedSource&lt;T&gt; source, Expression&lt;Func&lt;T, bool&gt;&gt; predicate, bool preserveOriginalOrder)</code></pre>
</div>
<div class="codewrapper">
  <pre><code class="lang-vbnet hljs">Public Shared Function Where(Of T)(source As IIndexedSource(Of T), predicate As Expression(Of Func(Of T, Boolean)), preserveOriginalOrder As Boolean) As IIndexedSource(Of T)</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;T&gt;</td>
      <td><span class="parametername">source</span></td>
      <td><p>An <a class="xref" href="C1.LiveLinq.Indexing.IIndexedSource-1.html">IIndexedSource&lt;T&gt;</a> to filter.</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;T, <a class="xref" href="https://learn.microsoft.com/dotnet/api/system.boolean">bool</a>&gt;&gt;</td>
      <td><span class="parametername">predicate</span></td>
      <td><p>A function to test each element for a condition.</p>
</td>
    </tr>
    <tr>
      <td><a class="xref" href="https://learn.microsoft.com/dotnet/api/system.boolean">bool</a></td>
      <td><span class="parametername">preserveOriginalOrder</span></td>
      <td><p>Specifies whether the source order must be preserved in the result.</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;T&gt;</td>
      <td><p>An <a class="xref" href="C1.LiveLinq.Indexing.IIndexedSource-1.html">IIndexedSource&lt;T&gt;</a> that contains elements from the input collection that satisfy the condition.</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">T</span></td>
      <td><p>The type of the elements of <i>source</i>.</p>
</td>
    </tr>
  </tbody>
</table>
<h5 id="C1_LiveLinq_IndexedQueryExtensions_Where__1_C1_LiveLinq_Indexing_IIndexedSource___0__System_Linq_Expressions_Expression_System_Func___0_System_Boolean___System_Boolean__remarks">Remarks</h5>
<div class="markdown level1 remarks"><p>Preserving the order can lessen the effect of performance optimization using an index.
Use this overload only if preserving the order in this operation is essential.</p>
</div>
</div>
