假设我们有一个Humans 的集合:
public class Human
{
public string FirstName { get; set; }
public string SecondName { get; set; }
public string CompanyName { get; set; }
}
var people = new List<Human>(){...};
我们如何在先按时FirstName再按时对人SecondName进行排序时实现自动完成CompanyName?
我试过:
people.Where(x => x.FirstName.StartsWith(term) || x.SecondName.StartsWith(term)
|| x.CompanyName.StartsWith(term))
.OrderBy(x => x.FirstName).ThenBy(x => x.SecondName).ThenBy(x => x.CompanyName)
但这不能正常工作。我想FirstName首先只查看所有匹配的字段,然后只查看SecondName字段等等。