0
我有一個用下面的代碼填充的列表框,但我希望對其中的項目進行排序。如何將項目列表框中如何對列表框中的項目進行升序排序
public void refreshInterface()
{
foreach (DataSet1.xspGetAnalysisUsageTypesRow homeForms in myDataSet.xspGetAnalysisUsageTypes)
{
var forms = new FormItems(homeForms);
listBox1.Items.Add(forms);
}
}
FormItems類排序:
public class FormItems
{
public DataSet1.xspGetAnalysisUsageTypesRow types { get; set; }
public FormItems(DataSet1.xspGetAnalysisUsageTypesRow usageTypes)
{
types = usageTypes;
}
public override string ToString()
{
return this.types.xlib_Desc;
}
}
對LINQ,您需要使用System.Linq的補充,我經常忘記當我學習Linq時... – harsimranb