# C1.WPF.RichTextBox.Documents.C1TextPointer.Closest

## Content

<div class="doc-site-dotnet-api-container">



<h1 id="C1_WPF_RichTextBox_Documents_C1TextPointer_Closest_" data-uid="C1.WPF.RichTextBox.Documents.C1TextPointer.Closest*">Closest Method
</h1>
<div class="markdown level0 summary"></div>
<div class="markdown level0 conceptual"></div>



<a id="C1_WPF_RichTextBox_Documents_C1TextPointer_Closest_" data-uid="C1.WPF.RichTextBox.Documents.C1TextPointer.Closest*"></a>
<h4 id="C1_WPF_RichTextBox_Documents_C1TextPointer_Closest_System_Func_C1_WPF_RichTextBox_Documents_C1TextPointer_System_Boolean__System_Func_C1_WPF_RichTextBox_Documents_C1TextPointer_C1_WPF_RichTextBox_Documents_C1TextPointer_System_Int32__C1_WPF_RichTextBox_Documents_C1TextElement_" data-uid="C1.WPF.RichTextBox.Documents.C1TextPointer.Closest(System.Func{C1.WPF.RichTextBox.Documents.C1TextPointer,System.Boolean},System.Func{C1.WPF.RichTextBox.Documents.C1TextPointer,C1.WPF.RichTextBox.Documents.C1TextPointer,System.Int32},C1.WPF.RichTextBox.Documents.C1TextElement)">Closest(Func&lt;C1TextPointer, bool&gt;, Func&lt;C1TextPointer, C1TextPointer, int&gt;, C1TextElement)</h4>
<div class="markdown level1 summary"><p>Returns the closest position that satisfies a predicate.</p>
</div>
<div class="markdown level1 conceptual"></div>
<h5 class="declaration">Declaration</h5>
<div class="codewrapper">
  <pre><code class="lang-csharp hljs">public C1TextPointer Closest(Func&lt;C1TextPointer, bool&gt; predicate, Func&lt;C1TextPointer, C1TextPointer, int&gt; distance, C1TextElement range)</code></pre>
</div>
<div class="codewrapper">
  <pre><code class="lang-vbnet hljs">Public Function Closest(predicate As Func(Of C1TextPointer, Boolean), distance As Func(Of C1TextPointer, C1TextPointer, Integer), range As C1TextElement) As C1TextPointer</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.func-2">Func</a>&lt;<a class="xref" href="C1.WPF.RichTextBox.Documents.C1TextPointer.html">C1TextPointer</a>, <a class="xref" href="https://learn.microsoft.com/dotnet/api/system.boolean">bool</a>&gt;</td>
      <td><span class="parametername">predicate</span></td>
      <td><p>The predicate that must be satisfied.</p>
</td>
    </tr>
    <tr>
      <td><a class="xref" href="https://learn.microsoft.com/dotnet/api/system.func-3">Func</a>&lt;<a class="xref" href="C1.WPF.RichTextBox.Documents.C1TextPointer.html">C1TextPointer</a>, <a class="xref" href="C1.WPF.RichTextBox.Documents.C1TextPointer.html">C1TextPointer</a>, <a class="xref" href="https://learn.microsoft.com/dotnet/api/system.int32">int</a>&gt;</td>
      <td><span class="parametername">distance</span></td>
      <td><p>A distance function.</p>
</td>
    </tr>
    <tr>
      <td><a class="xref" href="C1.WPF.RichTextBox.Documents.C1TextElement.html">C1TextElement</a></td>
      <td><span class="parametername">range</span></td>
      <td><p>The range to be searched in.</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.WPF.RichTextBox.Documents.C1TextPointer.html">C1TextPointer</a></td>
      <td><p>The closest position that satisfies the predicate.</p>
</td>
    </tr>
  </tbody>
</table>


<a id="C1_WPF_RichTextBox_Documents_C1TextPointer_Closest_" data-uid="C1.WPF.RichTextBox.Documents.C1TextPointer.Closest*"></a>
<h4 id="C1_WPF_RichTextBox_Documents_C1TextPointer_Closest_System_Func_C1_WPF_RichTextBox_Documents_C1TextPointer_System_Boolean__System_Func_C1_WPF_RichTextBox_Documents_C1TextPointer_C1_WPF_RichTextBox_Documents_C1TextPointer_System_Int32__" data-uid="C1.WPF.RichTextBox.Documents.C1TextPointer.Closest(System.Func{C1.WPF.RichTextBox.Documents.C1TextPointer,System.Boolean},System.Func{C1.WPF.RichTextBox.Documents.C1TextPointer,C1.WPF.RichTextBox.Documents.C1TextPointer,System.Int32})">Closest(Func&lt;C1TextPointer, bool&gt;, Func&lt;C1TextPointer, C1TextPointer, int&gt;)</h4>
<div class="markdown level1 summary"><p>Returns the closest position that satisfies a predicate.</p>
</div>
<div class="markdown level1 conceptual"></div>
<h5 class="declaration">Declaration</h5>
<div class="codewrapper">
  <pre><code class="lang-csharp hljs">public C1TextPointer Closest(Func&lt;C1TextPointer, bool&gt; predicate, Func&lt;C1TextPointer, C1TextPointer, int&gt; distance)</code></pre>
</div>
<div class="codewrapper">
  <pre><code class="lang-vbnet hljs">Public Function Closest(predicate As Func(Of C1TextPointer, Boolean), distance As Func(Of C1TextPointer, C1TextPointer, Integer)) As C1TextPointer</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.func-2">Func</a>&lt;<a class="xref" href="C1.WPF.RichTextBox.Documents.C1TextPointer.html">C1TextPointer</a>, <a class="xref" href="https://learn.microsoft.com/dotnet/api/system.boolean">bool</a>&gt;</td>
      <td><span class="parametername">predicate</span></td>
      <td><p>The predicate that must be satisfied.</p>
</td>
    </tr>
    <tr>
      <td><a class="xref" href="https://learn.microsoft.com/dotnet/api/system.func-3">Func</a>&lt;<a class="xref" href="C1.WPF.RichTextBox.Documents.C1TextPointer.html">C1TextPointer</a>, <a class="xref" href="C1.WPF.RichTextBox.Documents.C1TextPointer.html">C1TextPointer</a>, <a class="xref" href="https://learn.microsoft.com/dotnet/api/system.int32">int</a>&gt;</td>
      <td><span class="parametername">distance</span></td>
      <td><p>A distance function.</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.WPF.RichTextBox.Documents.C1TextPointer.html">C1TextPointer</a></td>
      <td><p>The closest position that satisfies the predicate.</p>
</td>
    </tr>
  </tbody>
</table>
</div>
