How to use LINQ to query list of strings that do not contain substring entries from another list
Posted
by p.campbell
on Stack Overflow
See other posts from Stack Overflow
or by p.campbell
Published on 2010-05-17T22:55:30Z
Indexed on
2010/05/17
23:00 UTC
Read the original article
Hit count: 258
string candidates = new string[] {
"Luke_jedi", "Force_unknown",
"Vader_jedi" , "Emperor_human", "r2d2_robot"
};
string[] disregard = new string[] {"_robot", "_jedi"};
//find those that aren't jedi or robots.
var nonJedi = candidates.Where(c=>
c.??? //likely using EndsWith() and Any()
);
How would you implement this solution using LINQ to find all those that do not end with any of the disregards items?
© Stack Overflow or respective owner