What is the syntax for a LINQ filter for List?

c# entity-framework-core linq

Accepted Answer

According to what I understand, you wish to get a duplicate of the original.

 myFilters = myFilters.Where(s => s.SomeColumn.Contains(criterion1));

simply with a list of requirements.

Consequently, it should resemble this.

myFilters = myFilters
    .Where(record => 
        selectedNames
            .Any(selectedName => 
                 record.Name.Contains(selectedName)));

use the Any extension procedure.

3
3/11/2020 7:57:42 PM


Related Questions





Related

Licensed under: CC-BY-SA with attribution
Not affiliated with Stack Overflow
Licensed under: CC-BY-SA with attribution
Not affiliated with Stack Overflow