c# - LINQ RemoveAll where property isn't working -


I have a module object and the module has a property view .

The scene is a list;

I want to remove all the views where the name is old_filename ( string ).

I have implemented the code below but it is not working and I think that I can pass.

  module + view = list & lt; View & gt; View + Name (string)  

LINQ

  mod.Scenes.RemoveAll (x => mod.Scenes.Any (y = & gt; Y .name == old_filename)); << Code>   

Assuming your RemoveAll status assumes that you Scene , whose name property is set to old_filename , all you have to do is

  Mod.Scenes.RemoveAll (x => x.Name == old_filename);  

Comments