# C1.Win.Accessibility.Items.BaseInterfaces.IUiaTextProvider.GetSelection

## Content

<div class="doc-site-dotnet-api-container">



<h1 id="C1_Win_Accessibility_Items_BaseInterfaces_IUiaTextProvider_GetSelection_" data-uid="C1.Win.Accessibility.Items.BaseInterfaces.IUiaTextProvider.GetSelection*">GetSelection Method
</h1>
<div class="markdown level0 summary"></div>
<div class="markdown level0 conceptual"></div>



<a id="C1_Win_Accessibility_Items_BaseInterfaces_IUiaTextProvider_GetSelection_" data-uid="C1.Win.Accessibility.Items.BaseInterfaces.IUiaTextProvider.GetSelection*"></a>
<h4 id="C1_Win_Accessibility_Items_BaseInterfaces_IUiaTextProvider_GetSelection" data-uid="C1.Win.Accessibility.Items.BaseInterfaces.IUiaTextProvider.GetSelection">GetSelection()</h4>
<div class="markdown level1 summary"><p>Retrieves the current selection.  For providers that have the concept of
text selection the provider should implement this method and also return
true for the SupportsTextSelection property below.  Otherwise this method
should throw an InvalidOperation exception.
For providers that support multiple disjoint selection, this should return
an array of all the currently selected ranges. Providers that don't support
multiple disjoint selection should just return an array containing a single
range.</p>
</div>
<div class="markdown level1 conceptual"></div>
<h5 class="declaration">Declaration</h5>
<div class="codewrapper">
  <pre><code class="lang-csharp hljs">ITextRangeProvider[] GetSelection()</code></pre>
</div>
<div class="codewrapper">
  <pre><code class="lang-vbnet hljs">Function GetSelection() As ITextRangeProvider()</code></pre>
</div>
<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="https://learn.microsoft.com/dotnet/api/system.windows.automation.provider.itextrangeprovider">ITextRangeProvider</a>[]</td>
      <td><p>The range of text that is selected, or possibly null if there is
no selection.</p>
</td>
    </tr>
  </tbody>
</table>
</div>
