C#: Custom order arrays, with a twist:
<p>The list I have is based on checking the first 4 values to sort correctly, but I need any other value in the list that is not predefined (and does not start with CS) to be prioritized as I have commented below.  The non predefined values would likely always be anything starting with a numeric value so anything starting with 1-9 (1,2,3,4,5,6,7,8,9).  </p>

<p>How can I custom sort something like this?  Should I focus on redefining anything beginning with 1-9 in a separate list, or is there something I can use that would represent "Anything not defined goes here"  Thanks!   </p>

<p>UPDATE: Thanks for your help everyone, I called it a night and used excel to generate every number combination from 0-9999 starting with 0000,0001 etc as well as 000-, 001- for the 3 digit numbers that go before the oddball CS #.  The cool thing is that the program takes a second or two to crunch everything which makes it look like it is doing a lot of work!  (I suppose it is)  I may add a progress bar!  Program is now 229kb, but it works!  Sometimes you just have to break out the duct tape.</p>

<pre><code>using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;


namespace WindowsFormsApplication1
{
public partial class Form1 : Form
{
    public Form1()
    {
        InitializeComponent();
    }

    public class Comparer : IComparer&lt;string&gt;
    {

        private Dictionary&lt;string, int&gt; _order;

        public Comparer()
        {
            List&lt;string&gt; list = new List&lt;string&gt;()
    {
        "CS01",
        "CS10",
        "CS58",
        "CS11",
        "CS71",
        "CS02",
        "CS55",
        "CS03",
        "CS70",
        "CS54",
        "CS60",
             //&lt;---How to prioritize any value that is not predefined in list to show up here?  such as 1234-444-555
        "CS57",

    };

            _order = new Dictionary&lt;string, int&gt;();
            for (int i = 0; i &lt; list.Count; i++)
            {
                _order.Add(list[i], i);
            }
        }

        public int Compare(string x, string y)
        {
            if (x.Length &lt; 4 || y.Length &lt; 4)
                return x.CompareTo(y);

            string xPrefix = x.Substring(0, 4);
            string yPrefix = y.Substring(0, 4);

            int xSequence;
            int ySequence;
            if (_order.TryGetValue(xPrefix, out xSequence)
                &amp;&amp; _order.TryGetValue(yPrefix, out ySequence))
            {
                return xSequence.CompareTo(ySequence);
            }
            else
            {
                return x.CompareTo(y);
            }
        }
    }

    private void button1_Click(object sender, EventArgs e)
    {

        textBox1.Text = textBox1.Text.Replace("(", "");
        textBox1.Text = textBox1.Text.Replace(")", "");
        string[] items = textBox1.Text.Split(Environment.NewLine.ToCharArray(), StringSplitOptions.RemoveEmptyEntries);
        Array.Sort&lt;string&gt;(items, 0, items.Length, new Comparer());
        textBox2.Text = String.Join(Environment.NewLine, items);

         }



}
</code></pre>

<p>}</p>
