Helper Class
Code: Select all
public class SitebarItem : IComparable<SitebarItem>
{
public string Text { get; set; }
public object Tag { get; set; }
public SitebarItem()
{
Text = "";
}
public SitebarItem(string text, object tag)
{
Text = text;
Tag = tag;
}
public int CompareTo(SitebarItem other)
{
return Text.CompareTo(other.Text);
}
}
Sort code
Code: Select all
List<SitebarItem> test = new List<SitebarItem>();
test.Add(new SitebarItem("B", "B"));
test.Add(new SitebarItem("A", "A"));
test.Sort();
string first = test[0].Text;
BUG
first is 'B', but it should be 'A'. Works fine in simulator