Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p><em>It sounds like you need to get canonicalized date sorting even though your date is represented as a string, yes?</em> Well, you can use LINQ's <code>OrderBy</code> operator, but you will have to parse the string into a date to achieve correct results:</p> <pre><code>items = items.OrderBy(item =&gt; DateTime.Parse(item.subLevelItem.DeliveryTime)) .ToList(); </code></pre> <p><strong>Update:</strong></p> <p>I've added this in for completeness - a real example of how I use ParseExact with Invariant culture:</p> <pre><code>var returnMessagesSorted = returnMessages.OrderBy((item =&gt; DateTime.ParseExact(item.EnvelopeInfo.DeliveryTime, ISDSFunctions.GetSolutionDateTimeFormat(), CultureInfo.InvariantCulture))); return returnMessagesSorted.ToList(); </code></pre> <p>You can always implement a separate IComparer class, it's not fun, but it works well:</p> <pre><code>public class TopLevelItemComparer : IComparer&lt;topLevelItem&gt; { public int Compare( topLevelItem x, topLevelItem y ) { return DateTime.Parse(x.subLevelItem.DeliveryTime).CompareTo( DateTime.Parse(y.subLevelItem.DeliveryTime) ); } } items.Sort( new TopLevelItemComparer() ); </code></pre> <p>Be aware that most <code>Sort()</code> methods in the .NET framework accept an <code>IComparer</code> or <code>IComparer&lt;T&gt;</code> which allows you to redefine the comparison semantics for any type. Normally, you just use <code>Comparer&lt;T&gt;.Default</code> - or use an overload that essentially supplies this for you.</p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. VO
      singulars
      1. This table or related slice is empty.
    2. VO
      singulars
      1. This table or related slice is empty.
    3. VO
      singulars
      1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload