如何使用linq和string.EndsWith(<数组中N个项中的1个>)

The*_*kal 3 .net c# linq

我在标题中有一个表达式.是否可以使用linq迭代数组并评估是否为真.例 string[] a = {"es","ag"}

if (string.EndsWith(<1 of N items in a>)==true){//do something}
Run Code Online (Sandbox Code Playgroud)

It'*_*ie. 6

if (a.Any(yourString.EndsWith))
{
    //your string ends with one of those endings.
}
Run Code Online (Sandbox Code Playgroud)