i have class like below,
public class SiteActionMap
{
public int Id { get; set; }
public string ImageName { get; set; }
public int ParentId { get; set; }
public string Name { get; set; }
public virtual ICollection<SiteActionMap> Childrens { get; set; }
public virtual SiteActionMap Parent { get; set; }
public bool Active { get; set; }
}
and i want to get a list with order by Children counts.
i am trying something like this,but i didnt work.
List<SiteActionMap> list = dbContext.SiteActionMap
.Include(m => m.Childrens)
.Include(m => m.Parent)
.OrderBy(i => i.Childrens.Count)
ToList();
how i can sort my list with children counts?
Adding on to what lbruder said, isn’t Count a method () in this case?