is it possible to recursively filter all items in recursive tree with linq to objects.
This is the model i am using. This is given to me by another application
public class Menu
{
public string Name{get;set;}
public string Roles{get;set;}
public List<Menu> Children{get;set;}
}
When the user logs into my application i need to check the users roles against the roles specified in for the menu item. I know i can write a recursive method that check this using a for loop.
I there anyway to get this using like ‘MenuList.Where(..check the roles)
thanks in advance
I’d just implement another method in the
Menuclass:And then you can just write LINQ queries like:
It will work recursively.