# C1.LiveLinq.LiveViews.Xml.XmlExtensions.IndexedElement

## Content

<div class="doc-site-dotnet-api-container">



<h1 id="C1_LiveLinq_LiveViews_Xml_XmlExtensions_IndexedElement_" data-uid="C1.LiveLinq.LiveViews.Xml.XmlExtensions.IndexedElement*">IndexedElement Method
</h1>
<div class="markdown level0 summary"></div>
<div class="markdown level0 conceptual"></div>



<a id="C1_LiveLinq_LiveViews_Xml_XmlExtensions_IndexedElement_" data-uid="C1.LiveLinq.LiveViews.Xml.XmlExtensions.IndexedElement*"></a>
<h4 id="C1_LiveLinq_LiveViews_Xml_XmlExtensions_IndexedElement_System_Xml_Linq_XContainer_System_Xml_Linq_XName_" data-uid="C1.LiveLinq.LiveViews.Xml.XmlExtensions.IndexedElement(System.Xml.Linq.XContainer,System.Xml.Linq.XName)">IndexedElement(XContainer, XName)</h4>
<div class="markdown level1 summary"><p>A hint to create and use an index on the specified XML element. The hint has default action.</p>
</div>
<div class="markdown level1 conceptual"></div>
<h5 class="declaration">Declaration</h5>
<div class="codewrapper">
  <pre><code class="lang-csharp hljs">public static XHint IndexedElement(this XContainer container, XName name)</code></pre>
</div>
<div class="codewrapper">
  <pre><code class="lang-vbnet hljs">Public Shared Function IndexedElement(container As XContainer, name As XName) As XHint</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.xml.linq.xcontainer">XContainer</a></td>
      <td><span class="parametername">container</span></td>
      <td><p>The element or document containing the element.</p>
</td>
    </tr>
    <tr>
      <td><a class="xref" href="https://learn.microsoft.com/dotnet/api/system.xml.linq.xname">XName</a></td>
      <td><span class="parametername">name</span></td>
      <td><p>The name of the element to get.</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.LiveViews.Xml.XHint.html">XHint</a></td>
      <td><p>The element that has the specified name.</p>
</td>
    </tr>
  </tbody>
</table>
<h5 id="C1_LiveLinq_LiveViews_Xml_XmlExtensions_IndexedElement_System_Xml_Linq_XContainer_System_Xml_Linq_XName__remarks">Remarks</h5>
<div class="markdown level1 remarks"><p>Hints are used declaratively. They tell LiveLinq query optimizer to create and use an index on this element, if possible.
When the query is executed, the hint method <b>IndexedElement</b> is replaced with the standard LINQ to XML method
<a class="xref" href="https://learn.microsoft.com/dotnet/api/system.xml.linq.xcontainer.element">Element(XName)</a>. See <a class="xref" href="C1.LiveLinq.Hints.html">Hints</a> for more details.</p>
</div>
<h5 id="C1_LiveLinq_LiveViews_Xml_XmlExtensions_IndexedElement_System_Xml_Linq_XContainer_System_Xml_Linq_XName__examples">Examples</h5>
<pre><code class="lang-csharp">var query =
    from c in customers
    where (string)c.IndexedElement("CustomerID") == "ALFKI"
    select c;</code></pre>



<a id="C1_LiveLinq_LiveViews_Xml_XmlExtensions_IndexedElement_" data-uid="C1.LiveLinq.LiveViews.Xml.XmlExtensions.IndexedElement*"></a>
<h4 id="C1_LiveLinq_LiveViews_Xml_XmlExtensions_IndexedElement_System_Xml_Linq_XElement_" data-uid="C1.LiveLinq.LiveViews.Xml.XmlExtensions.IndexedElement(System.Xml.Linq.XElement)">IndexedElement(XElement)</h4>
<div class="markdown level1 summary"><p>A hint to create and use an index on the specified XML element. The hint has default action.</p>
</div>
<div class="markdown level1 conceptual"></div>
<h5 class="declaration">Declaration</h5>
<div class="codewrapper">
  <pre><code class="lang-csharp hljs">public static XHint IndexedElement(this XElement element)</code></pre>
</div>
<div class="codewrapper">
  <pre><code class="lang-vbnet hljs">Public Shared Function IndexedElement(element As XElement) As XHint</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.xml.linq.xelement">XElement</a></td>
      <td><span class="parametername">element</span></td>
      <td><p>The element to apply the hint to.</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.LiveViews.Xml.XHint.html">XHint</a></td>
      <td><p>Formally, the hint returns the same value that it receives in the parameter. In fact, it is never executed,
its role is purely declarative.</p>
</td>
    </tr>
  </tbody>
</table>
<h5 id="C1_LiveLinq_LiveViews_Xml_XmlExtensions_IndexedElement_System_Xml_Linq_XElement__remarks">Remarks</h5>
<div class="markdown level1 remarks"><p>Hints are used declaratively. They tell LiveLinq query optimizer to create and use an index on this element, if possible.
After it is used for query optimization, before the query is executed, this hint is removed from the expression.
See <a class="xref" href="C1.LiveLinq.Hints.html">Hints</a> for more details.</p>
</div>
<h5 id="C1_LiveLinq_LiveViews_Xml_XmlExtensions_IndexedElement_System_Xml_Linq_XElement__examples">Examples</h5>
<pre><code class="lang-csharp">var query =
    from c in customers
    where (string)c.Element("CustomerID").IndexedElement() == "ALFKI"
    select c;</code></pre>



<a id="C1_LiveLinq_LiveViews_Xml_XmlExtensions_IndexedElement_" data-uid="C1.LiveLinq.LiveViews.Xml.XmlExtensions.IndexedElement*"></a>
<h4 id="C1_LiveLinq_LiveViews_Xml_XmlExtensions_IndexedElement_System_Xml_Linq_XElement_C1_LiveLinq_IndexingHintAction_" data-uid="C1.LiveLinq.LiveViews.Xml.XmlExtensions.IndexedElement(System.Xml.Linq.XElement,C1.LiveLinq.IndexingHintAction)">IndexedElement(XElement, IndexingHintAction)</h4>
<div class="markdown level1 summary"><p>A hint to create and use an index on the specified XML element. The hint has specified action.</p>
</div>
<div class="markdown level1 conceptual"></div>
<h5 class="declaration">Declaration</h5>
<div class="codewrapper">
  <pre><code class="lang-csharp hljs">public static XHint IndexedElement(this XElement element, IndexingHintAction action)</code></pre>
</div>
<div class="codewrapper">
  <pre><code class="lang-vbnet hljs">Public Shared Function IndexedElement(element As XElement, action As IndexingHintAction) As XHint</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.xml.linq.xelement">XElement</a></td>
      <td><span class="parametername">element</span></td>
      <td><p>The element to apply the hint to.</p>
</td>
    </tr>
    <tr>
      <td><a class="xref" href="C1.LiveLinq.IndexingHintAction.html">IndexingHintAction</a></td>
      <td><span class="parametername">action</span></td>
      <td><p>The action specified by the hint.</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.LiveViews.Xml.XHint.html">XHint</a></td>
      <td><p>Formally, the hint returns the same value that it receives in the parameter. In fact, it is never executed,
its role is purely declarative.</p>
</td>
    </tr>
  </tbody>
</table>
<h5 id="C1_LiveLinq_LiveViews_Xml_XmlExtensions_IndexedElement_System_Xml_Linq_XElement_C1_LiveLinq_IndexingHintAction__remarks">Remarks</h5>
<div class="markdown level1 remarks"><p>Hints are used declaratively. They tell LiveLinq query optimizer to create and use an index on this element, if possible.
After it is used for query optimization, before the query is executed, this hint is removed from the expression.
See <a class="xref" href="C1.LiveLinq.Hints.html">Hints</a> for more details.</p>
</div>
<h5 id="C1_LiveLinq_LiveViews_Xml_XmlExtensions_IndexedElement_System_Xml_Linq_XElement_C1_LiveLinq_IndexingHintAction__examples">Examples</h5>
<pre><code class="lang-csharp">var query =
    from c in customers
    where (string)c.Element("CustomerID").IndexedElement(IndexingHintAction.Mandatory) == "ALFKI"
    select c;</code></pre>



<a id="C1_LiveLinq_LiveViews_Xml_XmlExtensions_IndexedElement_" data-uid="C1.LiveLinq.LiveViews.Xml.XmlExtensions.IndexedElement*"></a>
<h4 id="C1_LiveLinq_LiveViews_Xml_XmlExtensions_IndexedElement_System_Xml_Linq_XContainer_System_Xml_Linq_XName_C1_LiveLinq_IndexingHintAction_" data-uid="C1.LiveLinq.LiveViews.Xml.XmlExtensions.IndexedElement(System.Xml.Linq.XContainer,System.Xml.Linq.XName,C1.LiveLinq.IndexingHintAction)">IndexedElement(XContainer, XName, IndexingHintAction)</h4>
<div class="markdown level1 summary"><p>A hint to create and use an index on the specified XML element. The hint has specified action.</p>
</div>
<div class="markdown level1 conceptual"></div>
<h5 class="declaration">Declaration</h5>
<div class="codewrapper">
  <pre><code class="lang-csharp hljs">public static XHint IndexedElement(this XContainer container, XName name, IndexingHintAction action)</code></pre>
</div>
<div class="codewrapper">
  <pre><code class="lang-vbnet hljs">Public Shared Function IndexedElement(container As XContainer, name As XName, action As IndexingHintAction) As XHint</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.xml.linq.xcontainer">XContainer</a></td>
      <td><span class="parametername">container</span></td>
      <td><p>The element or document containing the element.</p>
</td>
    </tr>
    <tr>
      <td><a class="xref" href="https://learn.microsoft.com/dotnet/api/system.xml.linq.xname">XName</a></td>
      <td><span class="parametername">name</span></td>
      <td><p>The name of the element to get.</p>
</td>
    </tr>
    <tr>
      <td><a class="xref" href="C1.LiveLinq.IndexingHintAction.html">IndexingHintAction</a></td>
      <td><span class="parametername">action</span></td>
      <td><p>The action specified by the hint.</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.LiveViews.Xml.XHint.html">XHint</a></td>
      <td><p>The element that has the specified name.</p>
</td>
    </tr>
  </tbody>
</table>
<h5 id="C1_LiveLinq_LiveViews_Xml_XmlExtensions_IndexedElement_System_Xml_Linq_XContainer_System_Xml_Linq_XName_C1_LiveLinq_IndexingHintAction__remarks">Remarks</h5>
<div class="markdown level1 remarks"><p>Hints are used declaratively. They tell LiveLinq query optimizer to create and use an index on this element, if possible.
When the query is executed, the hint method <b>IndexedElement</b> is replaced with the standard LINQ to XML method
<a class="xref" href="https://learn.microsoft.com/dotnet/api/system.xml.linq.xcontainer.element">Element(XName)</a>. See <a class="xref" href="C1.LiveLinq.Hints.html">Hints</a> for more details.</p>
</div>
<h5 id="C1_LiveLinq_LiveViews_Xml_XmlExtensions_IndexedElement_System_Xml_Linq_XContainer_System_Xml_Linq_XName_C1_LiveLinq_IndexingHintAction__examples">Examples</h5>
<pre><code class="lang-csharp">var query =
    from c in customers
    where (string)c.IndexedElement("CustomerID", IndexingHintAction.Mandatory) == "ALFKI"
    select c;</code></pre>

</div>
