# C1.LiveLinq.AdoNet.AdoNetExtensions.AsIndexed

## Content

<div class="doc-site-dotnet-api-container">



<h1 id="C1_LiveLinq_AdoNet_AdoNetExtensions_AsIndexed_" data-uid="C1.LiveLinq.AdoNet.AdoNetExtensions.AsIndexed*">AsIndexed Method
</h1>
<div class="markdown level0 summary"></div>
<div class="markdown level0 conceptual"></div>



<a id="C1_LiveLinq_AdoNet_AdoNetExtensions_AsIndexed_" data-uid="C1.LiveLinq.AdoNet.AdoNetExtensions.AsIndexed*"></a>
<h4 id="C1_LiveLinq_AdoNet_AdoNetExtensions_AsIndexed_System_Data_DataTable_" data-uid="C1.LiveLinq.AdoNet.AdoNetExtensions.AsIndexed(System.Data.DataTable)">AsIndexed(DataTable)</h4>
<div class="markdown level1 summary"><p>Wraps a <a class="xref" href="https://learn.microsoft.com/dotnet/api/system.data.datatable">DataTable</a> in an <a class="xref" href="C1.LiveLinq.AdoNet.IndexedDataTable-1.html">IndexedDataTable&lt;DataRow&gt;</a> so it can be indexed and
queried using the optimized query operators from <a class="xref" href="C1.LiveLinq.IndexedQueryExtensions.html">IndexedQueryExtensions</a>.</p>
</div>
<div class="markdown level1 conceptual"></div>
<h5 class="declaration">Declaration</h5>
<div class="codewrapper">
  <pre><code class="lang-csharp hljs">public static IndexedDataTable&lt;DataRow&gt; AsIndexed(this DataTable table)</code></pre>
</div>
<div class="codewrapper">
  <pre><code class="lang-vbnet hljs">Public Shared Function AsIndexed(table As DataTable) As IndexedDataTable(Of DataRow)</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.data.datatable">DataTable</a></td>
      <td><span class="parametername">table</span></td>
      <td><p>A <a class="xref" href="https://learn.microsoft.com/dotnet/api/system.data.datatable">DataTable</a> to represent as an <a class="xref" href="C1.LiveLinq.AdoNet.IndexedDataTable-1.html">IndexedDataTable&lt;DataRow&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.AdoNet.IndexedDataTable-1.html">IndexedDataTable</a>&lt;<a class="xref" href="https://learn.microsoft.com/dotnet/api/system.data.datarow">DataRow</a>&gt;</td>
      <td><p>An <a class="xref" href="C1.LiveLinq.AdoNet.IndexedDataTable-1.html">IndexedDataTable&lt;DataRow&gt;</a> that contains the same rows as <i>table</i>
and enables indexing of its rows.</p>
</td>
    </tr>
  </tbody>
</table>
<h5 id="C1_LiveLinq_AdoNet_AdoNetExtensions_AsIndexed_System_Data_DataTable__remarks">Remarks</h5>
<div class="markdown level1 remarks"><p>Use this method to index ADO.NET data tables and query them using the query operators optimized with indexing.</p>
<p>Elements of the source data table aren't duplicated or copied to a new collection.
This method just wraps the original data table in an <a class="xref" href="C1.LiveLinq.AdoNet.IndexedDataTable-1.html">IndexedDataTable&lt;DataRow&gt;</a>.</p>
<b>Note:</b> The <a class="xref" href="C1.LiveLinq.AdoNet.IndexedDataTable-1.html">IndexedDataTable&lt;DataRow&gt;</a> wrapper is owned by the original <a class="xref" href="https://learn.microsoft.com/dotnet/api/system.data.datatable">DataTable</a> object
(in fact, it is stored in its <b>ExtendedProperties</b>). So, if you create a wrapper for the same data table several times,
it will be the same object.
</div>


<a id="C1_LiveLinq_AdoNet_AdoNetExtensions_AsIndexed_" data-uid="C1.LiveLinq.AdoNet.AdoNetExtensions.AsIndexed*"></a>
<h4 id="C1_LiveLinq_AdoNet_AdoNetExtensions_AsIndexed__1_System_Data_DataTable_" data-uid="C1.LiveLinq.AdoNet.AdoNetExtensions.AsIndexed``1(System.Data.DataTable)">AsIndexed&lt;TRow&gt;(DataTable)</h4>
<div class="markdown level1 summary"><p>Wraps a <a class="xref" href="https://learn.microsoft.com/dotnet/api/system.data.datatable">DataTable</a> in an <a class="xref" href="C1.LiveLinq.AdoNet.IndexedDataTable-1.html">IndexedDataTable&lt;TRow&gt;</a> so it can be indexed and
queried using the optimized query operators from <a class="xref" href="C1.LiveLinq.IndexedQueryExtensions.html">IndexedQueryExtensions</a>.</p>
</div>
<div class="markdown level1 conceptual"></div>
<h5 class="declaration">Declaration</h5>
<div class="codewrapper">
  <pre><code class="lang-csharp hljs">public static IndexedDataTable&lt;TRow&gt; AsIndexed&lt;TRow&gt;(this DataTable table) where TRow : DataRow</code></pre>
</div>
<div class="codewrapper">
  <pre><code class="lang-vbnet hljs">Public Shared Function AsIndexed(Of TRow As DataRow)(table As DataTable) As IndexedDataTable(Of TRow)</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.data.datatable">DataTable</a></td>
      <td><span class="parametername">table</span></td>
      <td><p>A <a class="xref" href="https://learn.microsoft.com/dotnet/api/system.data.datatable">DataTable</a> to represent as an <a class="xref" href="C1.LiveLinq.AdoNet.IndexedDataTable-1.html">IndexedDataTable&lt;TRow&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.AdoNet.IndexedDataTable-1.html">IndexedDataTable</a>&lt;TRow&gt;</td>
      <td><p>An <a class="xref" href="C1.LiveLinq.AdoNet.IndexedDataTable-1.html">IndexedDataTable&lt;TRow&gt;</a> that contains the same rows as <i>table</i>
and enables indexing of its rows.</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">TRow</span></td>
      <td><p>The type of the rows in the <i>table</i>.</p>
</td>
    </tr>
  </tbody>
</table>
<h5 id="C1_LiveLinq_AdoNet_AdoNetExtensions_AsIndexed__1_System_Data_DataTable__remarks">Remarks</h5>
<div class="markdown level1 remarks"><p>Use this method to index ADO.NET data tables and query them using the query operators optimized with indexing.</p>
<p>Elements of the source data table aren't duplicated or copied to a new collection.
This method just wraps the original data table in an <a class="xref" href="C1.LiveLinq.AdoNet.IndexedDataTable-1.html">IndexedDataTable&lt;TRow&gt;</a>.</p>
<b>Note:</b> The <a class="xref" href="C1.LiveLinq.AdoNet.IndexedDataTable-1.html">IndexedDataTable&lt;TRow&gt;</a> wrapper is owned by the original <a class="xref" href="https://learn.microsoft.com/dotnet/api/system.data.datatable">DataTable</a> object
(in fact, it is stored in its <b>ExtendedProperties</b>). So, if you create a wrapper for the same data table several times,
it will be the same object.
</div>


<a id="C1_LiveLinq_AdoNet_AdoNetExtensions_AsIndexed_" data-uid="C1.LiveLinq.AdoNet.AdoNetExtensions.AsIndexed*"></a>
<h4 id="C1_LiveLinq_AdoNet_AdoNetExtensions_AsIndexed__1_System_Data_TypedTableBase___0__" data-uid="C1.LiveLinq.AdoNet.AdoNetExtensions.AsIndexed``1(System.Data.TypedTableBase{``0})">AsIndexed&lt;TRow&gt;(TypedTableBase&lt;TRow&gt;)</h4>
<div class="markdown level1 summary"><p>Wraps a typed ADO.NET data table in an <a class="xref" href="C1.LiveLinq.AdoNet.IndexedDataTable-1.html">IndexedDataTable&lt;TRow&gt;</a> so it can be indexed and
queried using the optimized query operators from <a class="xref" href="C1.LiveLinq.IndexedQueryExtensions.html">IndexedQueryExtensions</a>.</p>
</div>
<div class="markdown level1 conceptual"></div>
<h5 class="declaration">Declaration</h5>
<div class="codewrapper">
  <pre><code class="lang-csharp hljs">public static IndexedDataTable&lt;TRow&gt; AsIndexed&lt;TRow&gt;(this TypedTableBase&lt;TRow&gt; table) where TRow : DataRow</code></pre>
</div>
<div class="codewrapper">
  <pre><code class="lang-vbnet hljs">Public Shared Function AsIndexed(Of TRow As DataRow)(table As TypedTableBase(Of TRow)) As IndexedDataTable(Of TRow)</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.data.typedtablebase-1">TypedTableBase</a>&lt;TRow&gt;</td>
      <td><span class="parametername">table</span></td>
      <td><p>A typed data table to represent as an <a class="xref" href="C1.LiveLinq.AdoNet.IndexedDataTable-1.html">IndexedDataTable&lt;TRow&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.AdoNet.IndexedDataTable-1.html">IndexedDataTable</a>&lt;TRow&gt;</td>
      <td><p>An <a class="xref" href="C1.LiveLinq.AdoNet.IndexedDataTable-1.html">IndexedDataTable&lt;TRow&gt;</a> that contains the same rows as <i>table</i>
and enables indexing of its rows.</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">TRow</span></td>
      <td><p>The type of the rows in the <i>table</i>.</p>
</td>
    </tr>
  </tbody>
</table>
<h5 id="C1_LiveLinq_AdoNet_AdoNetExtensions_AsIndexed__1_System_Data_TypedTableBase___0___remarks">Remarks</h5>
<div class="markdown level1 remarks"><p>Use this method to index typed data tables and query them using the query operators optimized with indexing.</p>
<p>Elements of the source data table aren't duplicated or copied to a new collection.
This method just wraps the original data table in an <a class="xref" href="C1.LiveLinq.AdoNet.IndexedDataTable-1.html">IndexedDataTable&lt;TRow&gt;</a>.</p>
<b>Note:</b> The <a class="xref" href="C1.LiveLinq.AdoNet.IndexedDataTable-1.html">IndexedDataTable&lt;TRow&gt;</a> wrapper is owned by the original <a class="xref" href="https://learn.microsoft.com/dotnet/api/system.data.datatable">DataTable</a> object
(in fact, it is stored in its <b>ExtendedProperties</b>). So, if you create a wrapper for the same data table several times,
it will be the same object.
</div>
</div>
