I have a recursive method that is return me categories, and checking for its sub categories.
So it looks like:
public List GetAllChildCat
I think this linq version will allow you to avoid the overhead of creating a list:
public IEnumerable GetAllChildCats(int categoryid)
{
Category c = Get(categoryid);
return new[] { c }.Concat(c.ChildCategories.SelectMany(cat => GetAllChildCats(cat)));
}
You can always call ToList() on the returned IEnumerable if you need it.