如何使用LINQ查询不包含来自另一个列表的子字符串条目的字符串列表

p.c*_*ell 3 c# linq

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()
              ); 
Run Code Online (Sandbox Code Playgroud)

您将如何使用LINQ实现此解决方案,以找到所有不以任何无视项目结束的解决方案?

Luk*_*keH 7

var nonJedi = candidates.Where(c => !disregard.Any(d => c.EndsWith(d)));
Run Code Online (Sandbox Code Playgroud)