我在 sitefinity 中有一个返回类别列表的函数。
//return list of categories
private IList<ICategory> GetCategoryDataSource() {
var cntManager = new ContentManager(CaseStudyManager.DefaultContentProvider);
IList allCategories = cntManager.GetCategories();
List<ICategory> filteredList = new List<ICategory>();
foreach (ICategory category in allCategories) {
filteredList.Add(category);
}
return filteredList;
}
我想知道的是如何对这个列表进行排序。
据我所知,Sitefinity 中的类别只是一个字符串,没有与类别关联的其他字段。因此,除了为每个类别附加一个数字之外,我没有什么可以对类别进行排序的,例如:
1 - Legal
2 - Financial
3 - Property
当这些类别显示在网站上时,我至少可以修剪我需要的部分。
任何人都可以帮助排序吗?
谢谢艾尔