how should C# linq orderby thenby be used?
<p>I have a list of objects modeling toolbars and I'm trying to sort it based on 4 properties: </p>

<pre><code>List&lt;MenuItemViewModel&gt; sortingList = new List&lt;MenuItemViewModel&gt;;
FillSortingList();
sortingList.OrderBy(m =&gt; m.RoleId)
            .ThenBy(m =&gt; m.ToolbarLocation)
            .ThenBy(m =&gt; m.Band)
            .ThenBy(m =&gt; m.BandIndex);
</code></pre>

<p>The objects are of type:</p>

<pre><code>public class MenuItemViewModel : ViewModel
{        
    public int Id { get; set; }
    public bool IsCheckable { get; private set; }
    public string Name { get; private set; }
    public int RoleId { get; private set; }
    public int Band  { get;  set; }
    public int BandIndex { get;  set; }
    public ToolbarLocation { get;  set; }
}
</code></pre>

<p>ToolbarLocation is enum of same name:</p>

<pre><code>public enum ToolbarLocation
{
    Left = 0,
    Top = 1,
    Float = 2
}
</code></pre>

<p>The sorted list is ok regarding RoleId, but within range of one RoleId the locations Top and Left are mixed. Same with Band values 0 and 1. The only order within range of one role is by the BandIndex. </p>

<p>So to me it seems it's doing:</p>

<pre><code>_sortingList.OrderBy(m =&gt; m.RoleId).ThenBy(m =&gt; m.BandIndex);
</code></pre>