Recently I wrote a piece of C # code that uses the Lambda expression:
var dynMenu = new list & lt; MenuItem & gt; (); // DynMenu to add some code to menu items (! DynMenu.Any (x => x.Text == Controller)) {// Something}
My While going to code, I came to know that each menu item has a property called Child ITEMs, which is the menu item type, it is important, I think I will replace this menu item with my menu list.
To change the first row:
var dynMenu = new MenuItemCollection ();
I have noticed that this menu contains any extension methods such as "any
Is there any way to use Lambda expression?
Do I just "list"
is a .NET 1.1 class. This does not apply to any common archive interface, especially, IEnumerable & lt; MenuItem & gt;
.
Since it is not only IEnumerable and not IEnumerable & lt; MenuItem & gt;
, LINQ provides all the extension methods for which this does not work, however, you can get them back by:
if (dynMenu.Cast & lt; MenuItem & gt; (). Any (x => x.Test == Controller)) {// ...
In the extension method IEnumerable
to IEnumerable & lt; T & gt;
, other LINQ extensions change to provide access to the methods.
Comments
Post a Comment