Sorting an IList
<p>I have got a complete list of my brands to appear in my <code>DropDownBox</code>, however there appears to be no order (simply how they are input into the database) and I need to sort them into alphabetical order.</p>

<p>But it doesn't look like I can use the .Sort(); on an <code>IList</code> and there doesn't seem to be anything similar on <code>ILists</code> so I am at a bit of a loss, I have tried to convert the <code>IList</code> into a <code>List</code> and then using the <code>List.Sort()</code> method but I have had no luck with this as it just comes back unsorted again:</p>

<pre><code>public void BrandListRetrieve()
{
    var factory = new BrandFactory();
    var customBool1State = 
          factory.ByCustomBoolean1(false, CoreHttpModule.Session);

    if (customBool1State != null)
    {
        var brandDropDown = CoreHttpModule
                                .Session
                                .CreateCriteria(typeof(Brand)).List&lt;Brand&gt;();

        foreach (Brand brand in brandDropDown)
        {
            this.Items.Add(brand.Name);
        }

        if (this.Items.Count &lt; 0)
        {
            this.Items.Insert(0, new ListItem("Hello World", "Hello World"));
        }

        var brandList = brandDropDown as List&lt;string&gt;;

        if (brandList != null)
            brandList.Sort();
    }
}
</code></pre>
