Note that there are some explanatory texts on larger screens.

plurals
  1. POI want to sort this list in .NET my sample code is below
    primarykey
    data
    text
    <pre><code>class Program { static void Main(string[] args) { //Period 01 2008, Period 02 2008 Series s1 = new Series { Text = "Period 01 2008", Value = "1"}; Series s2 = new Series { Text = "Period 02 2008", Value = "2" }; Series s3 = new Series { Text = "Period 03 2008", Value = "3" }; Series s11 = new Series { Text = "Period 01 2009", Value = "1" }; Series s21 = new Series { Text = "Period 02 2009", Value = "2" }; Series s31 = new Series { Text = "Period 03 2009", Value = "3" }; Series s12 = new Series { Text = "Period 01 2010", Value = "1" }; Series s22 = new Series { Text = "Period 02 2010", Value = "2" }; Series s32 = new Series { Text = "Period 03 2010", Value = "3" }; List&lt;Series&gt; series = new List&lt;Series&gt; { s21, s31, s1, s12, s11, s2, s22, s3, s32 }; // mySeries.ForEach(i =&gt; Console.WriteLine("Period {0} {1}",i.Period, i.Year)); series.ForEach(i =&gt; Console.WriteLine(i.Text)); Console.WriteLine("************************"); series.OrderBy(i =&gt; i.Text); series.ForEach(i=&gt; Console.WriteLine(i.Text)); } } public class Series { public string Text { get; set; } public string Value {get;set;} } </code></pre> <p>Basically I want my list to be ordered by the <code>Text</code> property of the <code>Series</code> class. I have a work-around by splitting the text, but I am looking for any other way - using <code>IComparer</code> maybe?</p> <p>The ordered list should be something like this:</p> <blockquote> <p>Period 01 2008, Period 02 2008, Period 03 2008, Period 01 2009, Period 02 2009...</p> </blockquote> <p><strong>Update:</strong> the definition of the <code>Series</code> class cannot be changed.</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. This table or related slice is empty.
    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