List<ValueValid> lst = DataService
.GetProductValidChildren(product.ProdType, (decimal)enumValue);
lst给我一个国家名称列表..我需要对此进行排序..你能帮助我吗?如何在ASP.NET中按字母顺序排序列表?
List<ValueValid> lst = DataService
.GetProductValidChildren(product.ProdType, (decimal)enumValue);
lst给我一个国家名称列表..我需要对此进行排序..你能帮助我吗?如何在ASP.NET中按字母顺序排序列表?
如果没有参数列表,你可以使用:
lst.Sort();
编辑:如果它是ValueValid
列表,你可以使用:
lst.Sort(delegate(ValueValid v1, ValueValid v2) { return v1.Country.CompareTo(v2.Country); });
假设ValueValid
有一个命名属性Country
。
可以使用System.Collections.SortedList
lst.OrderBy(W => w.Country));
您可以使用List<T>
类上的Sort methods!
请告诉我你打算把这个变量重命名为国家而不是lst ... – SeanJA 2009-09-15 10:47:32