# C1.DataCollection.C1DataCollectionEx.SortAsync

## Content

<div class="doc-site-dotnet-api-container">



<h1 id="C1_DataCollection_C1DataCollectionEx_SortAsync_" data-uid="C1.DataCollection.C1DataCollectionEx.SortAsync*">SortAsync Method
</h1>
<div class="markdown level0 summary"></div>
<div class="markdown level0 conceptual"></div>



<a id="C1_DataCollection_C1DataCollectionEx_SortAsync_" data-uid="C1.DataCollection.C1DataCollectionEx.SortAsync*"></a>
<h4 id="C1_DataCollection_C1DataCollectionEx_SortAsync__1_C1_DataCollection_C1DataCollection___0__System_Linq_Expressions_Expression_System_Func___0_System_Object___C1_DataCollection_SortDirection_" data-uid="C1.DataCollection.C1DataCollectionEx.SortAsync``1(C1.DataCollection.C1DataCollection{``0},System.Linq.Expressions.Expression{System.Func{``0,System.Object}},C1.DataCollection.SortDirection)">SortAsync&lt;T&gt;(C1DataCollection&lt;T&gt;, Expression&lt;Func&lt;T, object&gt;&gt;, SortDirection)</h4>
<div class="markdown level1 summary"><p>Sorts the data collection according to the specified sort path and direction.</p>
</div>
<div class="markdown level1 conceptual"></div>
<h5 class="declaration">Declaration</h5>
<div class="codewrapper">
  <pre><code class="lang-csharp hljs">public static Task SortAsync&lt;T&gt;(this C1DataCollection&lt;T&gt; dataCollection, Expression&lt;Func&lt;T, object&gt;&gt; sortPath, SortDirection sortDirection = SortDirection.Ascending) where T : class</code></pre>
</div>
<div class="codewrapper">
  <pre><code class="lang-vbnet hljs">Public Shared Function SortAsync(Of T As Class)(dataCollection As C1DataCollection(Of T), sortPath As Expression(Of Func(Of T, Object)), Optional sortDirection As SortDirection = SortDirection.Ascending) As Task</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="C1.DataCollection.C1DataCollection-1.html">C1DataCollection</a>&lt;T&gt;</td>
      <td><span class="parametername">dataCollection</span></td>
      <td><p>The data collection.</p>
</td>
    </tr>
    <tr>
      <td><a class="xref" href="https://learn.microsoft.com/dotnet/api/system.linq.expressions.expression-1">Expression</a>&lt;<a class="xref" href="https://learn.microsoft.com/dotnet/api/system.func-2">Func</a>&lt;T, <a class="xref" href="https://learn.microsoft.com/dotnet/api/system.object">object</a>&gt;&gt;</td>
      <td><span class="parametername">sortPath</span></td>
      <td><p>The filter path.</p>
</td>
    </tr>
    <tr>
      <td><a class="xref" href="C1.DataCollection.SortDirection.html">SortDirection</a></td>
      <td><span class="parametername">sortDirection</span></td>
      <td><p>The sort direction.</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="https://learn.microsoft.com/dotnet/api/system.threading.tasks.task">Task</a></td>
      <td></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">T</span></td>
      <td></td>
    </tr>
  </tbody>
</table>
</div>
