【发布时间】:2014-11-18 06:59:37
【问题描述】:
我有一个列表
IEnumerable<RSPCA.LIB.Models.Search.SearchItem> results =
newList<LIB.Models.Search.SearchItem>();
我的 searchItem 类有一个名为 content 的字符串字段。所以基本上我想根据特定字符串(术语)在内容字符串中出现的次数对列表进行排序。 所以假设我的术语是“abc”,所以如果列表的内容字段中的一项包含“abc”两次,另一项包含“abc”3 次,我希望该项在包含它两次的项之前。所以基本上是根据 Occurrence 对列表进行排序。我还在这里粘贴了我的搜索项类:
public class SearchItem : SearchResultItem
{
public string PageTitle { get; set; }
public string PageDescription { get; set; }
public string content {get; set;} // That's the one which I want to use
}
非常感谢任何帮助
【问题讨论】: