# C1.LiveLinq.LiveViews.Xml.XmlExtensions.IndexedAttribute

## Content

<div class="doc-site-dotnet-api-container">



<h1 id="C1_LiveLinq_LiveViews_Xml_XmlExtensions_IndexedAttribute_" data-uid="C1.LiveLinq.LiveViews.Xml.XmlExtensions.IndexedAttribute*">IndexedAttribute Method
</h1>
<div class="markdown level0 summary"></div>
<div class="markdown level0 conceptual"></div>



<a id="C1_LiveLinq_LiveViews_Xml_XmlExtensions_IndexedAttribute_" data-uid="C1.LiveLinq.LiveViews.Xml.XmlExtensions.IndexedAttribute*"></a>
<h4 id="C1_LiveLinq_LiveViews_Xml_XmlExtensions_IndexedAttribute_System_Xml_Linq_XElement_System_Xml_Linq_XName_" data-uid="C1.LiveLinq.LiveViews.Xml.XmlExtensions.IndexedAttribute(System.Xml.Linq.XElement,System.Xml.Linq.XName)">IndexedAttribute(XElement, XName)</h4>
<div class="markdown level1 summary"><p>A hint to create and use an index on the specified XML attribute. 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 IndexedAttribute(this XElement element, XName name)</code></pre>
</div>
<div class="codewrapper">
  <pre><code class="lang-vbnet hljs">Public Shared Function IndexedAttribute(element As XElement, 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.xelement">XElement</a></td>
      <td><span class="parametername">element</span></td>
      <td><p>The element containing the attribute.</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 attribute 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 attribute that has the specified name.</p>
</td>
    </tr>
  </tbody>
</table>
<h5 id="C1_LiveLinq_LiveViews_Xml_XmlExtensions_IndexedAttribute_System_Xml_Linq_XElement_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 attribute, if possible.
When the query is executed, the hint method <b>IndexedAttribute</b> is replaced with the standard LINQ to XML method
<a class="xref" href="https://learn.microsoft.com/dotnet/api/system.xml.linq.xelement.attribute">Attribute(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_IndexedAttribute_System_Xml_Linq_XElement_System_Xml_Linq_XName__examples">Examples</h5>
<pre><code class="lang-csharp">var query =
    from c in customers
    where (string)c.IndexedAttribute("CustomerID") == "ALFKI"
    select c;</code></pre>



<a id="C1_LiveLinq_LiveViews_Xml_XmlExtensions_IndexedAttribute_" data-uid="C1.LiveLinq.LiveViews.Xml.XmlExtensions.IndexedAttribute*"></a>
<h4 id="C1_LiveLinq_LiveViews_Xml_XmlExtensions_IndexedAttribute_System_Xml_Linq_XAttribute_" data-uid="C1.LiveLinq.LiveViews.Xml.XmlExtensions.IndexedAttribute(System.Xml.Linq.XAttribute)">IndexedAttribute(XAttribute)</h4>
<div class="markdown level1 summary"><p>A hint to create and use an index on the specified XML attribute. 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 IndexedAttribute(this XAttribute attribute)</code></pre>
</div>
<div class="codewrapper">
  <pre><code class="lang-vbnet hljs">Public Shared Function IndexedAttribute(attribute As XAttribute) 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.xattribute">XAttribute</a></td>
      <td><span class="parametername">attribute</span></td>
      <td><p>The attribute 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_IndexedAttribute_System_Xml_Linq_XAttribute__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 attribute, 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_IndexedAttribute_System_Xml_Linq_XAttribute__examples">Examples</h5>
<pre><code class="lang-csharp">var query =
    from c in customers
    where (string)c.Attribute("CustomerID").IndexedAttribute() == "ALFKI"
    select c;</code></pre>



<a id="C1_LiveLinq_LiveViews_Xml_XmlExtensions_IndexedAttribute_" data-uid="C1.LiveLinq.LiveViews.Xml.XmlExtensions.IndexedAttribute*"></a>
<h4 id="C1_LiveLinq_LiveViews_Xml_XmlExtensions_IndexedAttribute_System_Xml_Linq_XAttribute_C1_LiveLinq_IndexingHintAction_" data-uid="C1.LiveLinq.LiveViews.Xml.XmlExtensions.IndexedAttribute(System.Xml.Linq.XAttribute,C1.LiveLinq.IndexingHintAction)">IndexedAttribute(XAttribute, IndexingHintAction)</h4>
<div class="markdown level1 summary"><p>A hint to create and use an index on the specified XML attribute. 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 IndexedAttribute(this XAttribute attribute, IndexingHintAction action)</code></pre>
</div>
<div class="codewrapper">
  <pre><code class="lang-vbnet hljs">Public Shared Function IndexedAttribute(attribute As XAttribute, 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.xattribute">XAttribute</a></td>
      <td><span class="parametername">attribute</span></td>
      <td><p>The attribute 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_IndexedAttribute_System_Xml_Linq_XAttribute_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 attribute, 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_IndexedAttribute_System_Xml_Linq_XAttribute_C1_LiveLinq_IndexingHintAction__examples">Examples</h5>
<pre><code class="lang-csharp">var query =
    from c in customers
    where (string)c.Attribute("CustomerID").IndexedAttribute(IndexingHintAction.Mandatory) == "ALFKI"
    select c;</code></pre>



<a id="C1_LiveLinq_LiveViews_Xml_XmlExtensions_IndexedAttribute_" data-uid="C1.LiveLinq.LiveViews.Xml.XmlExtensions.IndexedAttribute*"></a>
<h4 id="C1_LiveLinq_LiveViews_Xml_XmlExtensions_IndexedAttribute_System_Xml_Linq_XElement_System_Xml_Linq_XName_C1_LiveLinq_IndexingHintAction_" data-uid="C1.LiveLinq.LiveViews.Xml.XmlExtensions.IndexedAttribute(System.Xml.Linq.XElement,System.Xml.Linq.XName,C1.LiveLinq.IndexingHintAction)">IndexedAttribute(XElement, XName, IndexingHintAction)</h4>
<div class="markdown level1 summary"><p>A hint to create and use an index on the specified XML attribute. 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 IndexedAttribute(this XElement element, XName name, IndexingHintAction action)</code></pre>
</div>
<div class="codewrapper">
  <pre><code class="lang-vbnet hljs">Public Shared Function IndexedAttribute(element As XElement, 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.xelement">XElement</a></td>
      <td><span class="parametername">element</span></td>
      <td><p>The element containing the attribute.</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 attribute 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 attribute that has the specified name.</p>
</td>
    </tr>
  </tbody>
</table>
<h5 id="C1_LiveLinq_LiveViews_Xml_XmlExtensions_IndexedAttribute_System_Xml_Linq_XElement_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 attribute, if possible.
When the query is executed, the hint method <b>IndexedAttribute</b> is replaced with the standard LINQ to XML method
<a class="xref" href="https://learn.microsoft.com/dotnet/api/system.xml.linq.xelement.attribute">Attribute(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_IndexedAttribute_System_Xml_Linq_XElement_System_Xml_Linq_XName_C1_LiveLinq_IndexingHintAction__examples">Examples</h5>
<pre><code class="lang-csharp">var query =
    from c in customers
    where (string)c.IndexedAttribute("CustomerID", IndexingHintAction.Mandatory) == "ALFKI"
    select c;</code></pre>

</div>
