# C1.LiveLinq.IndexedQueryExtensions.ToIndexed

## Content

<div class="doc-site-dotnet-api-container">



<h1 id="C1_LiveLinq_IndexedQueryExtensions_ToIndexed_" data-uid="C1.LiveLinq.IndexedQueryExtensions.ToIndexed*">ToIndexed Method
</h1>
<div class="markdown level0 summary"></div>
<div class="markdown level0 conceptual"></div>



<a id="C1_LiveLinq_IndexedQueryExtensions_ToIndexed_" data-uid="C1.LiveLinq.IndexedQueryExtensions.ToIndexed*"></a>
<h4 id="C1_LiveLinq_IndexedQueryExtensions_ToIndexed__1_C1_LiveLinq_IObservableSource___0__" data-uid="C1.LiveLinq.IndexedQueryExtensions.ToIndexed``1(C1.LiveLinq.IObservableSource{``0})">ToIndexed&lt;T&gt;(IObservableSource&lt;T&gt;)</h4>
<div class="markdown level1 summary"><p>Creates an <a class="xref" href="C1.LiveLinq.Indexing.IIndexedSource-1.html">IIndexedSource&lt;T&gt;</a> based on the specified <a class="xref" href="C1.LiveLinq.IObservableSource-1.html">IObservableSource&lt;T&gt;</a> 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; ToIndexed&lt;T&gt;(this IObservableSource&lt;T&gt; source)</code></pre>
</div>
<div class="codewrapper">
  <pre><code class="lang-vbnet hljs">Public Shared Function ToIndexed(Of T)(source As IObservableSource(Of T)) 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.IObservableSource-1.html">IObservableSource</a>&lt;T&gt;</td>
      <td><span class="parametername">source</span></td>
      <td><p>An <a class="xref" href="C1.LiveLinq.IObservableSource-1.html">IObservableSource&lt;T&gt;</a> collection to base an <a class="xref" href="C1.LiveLinq.Indexing.IIndexedSource-1.html">IIndexedSource&lt;T&gt;</a> on.</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 the same elements as the <a class="xref" href="C1.LiveLinq.IObservableSource-1.html">IObservableSource&lt;T&gt;</a>
collection and enables indexing of that 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">T</span></td>
      <td><p>The type of the elements in the collection.</p>
</td>
    </tr>
  </tbody>
</table>
<h5 id="C1_LiveLinq_IndexedQueryExtensions_ToIndexed__1_C1_LiveLinq_IObservableSource___0___remarks">Remarks</h5>
<div class="markdown level1 remarks"><p>Use this method to index and query your collection if that collection is your own custom implementation
of the <a class="xref" href="C1.LiveLinq.IObservableSource-1.html">IObservableSource&lt;T&gt;</a> interface.</p>
<p>Elements of the source collection aren't duplicated or copied to a new collection.
This method just wraps the original collection in an <a class="xref" href="C1.LiveLinq.Indexing.IIndexedSource-1.html">IIndexedSource&lt;T&gt;</a>,
enabling its indexing by using the change notification mechanism of <a class="xref" href="C1.LiveLinq.IObservableSource-1.html">IObservableSource&lt;T&gt;</a>.</p>
<p><b>Note: </b>Indexes created on the resulting  <a class="xref" href="C1.LiveLinq.Indexing.IIndexedSource-1.html">IIndexedSource&lt;T&gt;</a> are owned by it
and not by the original collection. Every <b>ToIndexed()</b> call creates a separate object
that has its own separate indexes. Avoid calling <b>ToIndexed()</b> repeatedly 
for the same collection because it can increase the cost of maintaining indexes.</p>
</div>


<a id="C1_LiveLinq_IndexedQueryExtensions_ToIndexed_" data-uid="C1.LiveLinq.IndexedQueryExtensions.ToIndexed*"></a>
<h4 id="C1_LiveLinq_IndexedQueryExtensions_ToIndexed__1_System_ComponentModel_IBindingList_" data-uid="C1.LiveLinq.IndexedQueryExtensions.ToIndexed``1(System.ComponentModel.IBindingList)">ToIndexed&lt;T&gt;(IBindingList)</h4>
<div class="markdown level1 summary"><p>Creates an <a class="xref" href="C1.LiveLinq.Collections.IndexedCollection-1.html">IndexedCollection&lt;T&gt;</a> based on the specified <a class="xref" href="https://learn.microsoft.com/dotnet/api/system.componentmodel.ibindinglist">IBindingList</a> data source.</p>
</div>
<div class="markdown level1 conceptual"></div>
<h5 class="declaration">Declaration</h5>
<div class="codewrapper">
  <pre><code class="lang-csharp hljs">public static IndexedCollection&lt;T&gt; ToIndexed&lt;T&gt;(this IBindingList source)</code></pre>
</div>
<div class="codewrapper">
  <pre><code class="lang-vbnet hljs">Public Shared Function ToIndexed(Of T)(source As IBindingList) As IndexedCollection(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="https://learn.microsoft.com/dotnet/api/system.componentmodel.ibindinglist">IBindingList</a></td>
      <td><span class="parametername">source</span></td>
      <td><p>An <a class="xref" href="https://learn.microsoft.com/dotnet/api/system.componentmodel.ibindinglist">IBindingList</a> data source to represent as an <a class="xref" href="C1.LiveLinq.Collections.IndexedCollection-1.html">IndexedCollection&lt;T&gt;</a>.</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.Collections.IndexedCollection-1.html">IndexedCollection</a>&lt;T&gt;</td>
      <td><p>An <a class="xref" href="C1.LiveLinq.Collections.IndexedCollection-1.html">IndexedCollection&lt;T&gt;</a> that contains the same elements as the <a class="xref" href="https://learn.microsoft.com/dotnet/api/system.componentmodel.ibindinglist">IBindingList</a>
and enables indexing of that data source.</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 in the collection.</p>
</td>
    </tr>
  </tbody>
</table>
<h5 id="C1_LiveLinq_IndexedQueryExtensions_ToIndexed__1_System_ComponentModel_IBindingList__remarks">Remarks</h5>
<div class="markdown level1 remarks"><p>Use this method to index and query your existing data sources. The only requirements for the data source 
is that it implements the standard data binding interface <a class="xref" href="https://learn.microsoft.com/dotnet/api/system.componentmodel.ibindinglist">IBindingList</a>.</p>
<p><b>Note: </b>Indexes created on the resulting  <a class="xref" href="C1.LiveLinq.Collections.IndexedCollection-1.html">IndexedCollection&lt;T&gt;</a> are owned by it
and not by the original data source. Every <b>ToIndexed()</b> call creates a separate object that
has its own separate indexes. Avoid calling <b>ToIndexed()</b> repeatedly 
for the same collection because it can increase the cost of maintaining indexes.</p>
</div>


<a id="C1_LiveLinq_IndexedQueryExtensions_ToIndexed_" data-uid="C1.LiveLinq.IndexedQueryExtensions.ToIndexed*"></a>
<h4 id="C1_LiveLinq_IndexedQueryExtensions_ToIndexed__1_System_ComponentModel_BindingList___0__" data-uid="C1.LiveLinq.IndexedQueryExtensions.ToIndexed``1(System.ComponentModel.BindingList{``0})">ToIndexed&lt;T&gt;(BindingList&lt;T&gt;)</h4>
<div class="markdown level1 summary"><p>A typed specialization of the <a class="xref" href="C1.LiveLinq.IndexedQueryExtensions.ToIndexed.html#C1_LiveLinq_IndexedQueryExtensions_ToIndexed__1_System_ComponentModel_IBindingList_">ToIndexed&lt;T&gt;(IBindingList)</a> method.</p>
</div>
<div class="markdown level1 conceptual"></div>
<h5 class="declaration">Declaration</h5>
<div class="codewrapper">
  <pre><code class="lang-csharp hljs">public static IndexedCollection&lt;T&gt; ToIndexed&lt;T&gt;(this BindingList&lt;T&gt; source)</code></pre>
</div>
<div class="codewrapper">
  <pre><code class="lang-vbnet hljs">Public Shared Function ToIndexed(Of T)(source As BindingList(Of T)) As IndexedCollection(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="https://learn.microsoft.com/dotnet/api/system.componentmodel.bindinglist-1">BindingList</a>&lt;T&gt;</td>
      <td><span class="parametername">source</span></td>
      <td><p>A <a class="xref" href="https://learn.microsoft.com/dotnet/api/system.componentmodel.bindinglist-1">BindingList&lt;T&gt;</a> data source to represent as an <a class="xref" href="C1.LiveLinq.Collections.IndexedCollection-1.html">IndexedCollection&lt;T&gt;</a>.</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.Collections.IndexedCollection-1.html">IndexedCollection</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 the same elements as the <a class="xref" href="https://learn.microsoft.com/dotnet/api/system.componentmodel.bindinglist-1">BindingList&lt;T&gt;</a>
and enables indexing of that data source.</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 in the collection.</p>
</td>
    </tr>
  </tbody>
</table>
</div>
