Recently I wrote a piece of C# code utilizing a Lambda expression:
var dynMenu = new List<MenuItem>();
// some code to add menu items to dynMenu
if (!dynMenu.Any(x => x.Text == controller))
{
// do something
}
While going thru my code, I discovered that each MenuItem itself has a property called ChildItems which happens to be of type MenuItemCollection. Intrigued, I figured I would replace my List of MenuItem with this MenuItemCollection.
Upon changing the first line to:
var dynMenu = new MenuItemCollection();
I noticed that this MenuItemCollection type has no Extension Methods like "Any<>", "All<>", "First<>", etc., etc. -- which I find strange.
Is there a way to utilize Lambda expressions here?
Should I just go back to using "List<<\MenuItem>"?