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

C# 如何使用linq和string.EndsWith(<;数组中N项中的1项>;),c#,.net,linq,C#,.net,Linq,我在标题中有一个如上所述的表达。是否可以使用linq在数组中迭代并计算是否为真。例子 string[]a={“es”,“ag”} if(string.EndsWith()==true){//do something} 以什么结尾?应该有字符串来验证您的a数组有多少项?不如干脆string.EndsWith(“es”)| string.EndsWith(“ag”)?@SonerGönül a.长度通常较大。使| |使用效率非常低 if (string.EndsWith(<1 of N ite

我在标题中有一个如上所述的表达。是否可以使用linq在数组中迭代并计算是否为真。例子
string[]a={“es”,“ag”}

if(string.EndsWith()==true){//do something}

以什么结尾?应该有字符串来验证您的
a
数组有多少项?不如干脆
string.EndsWith(“es”)| string.EndsWith(“ag”)
?@SonerGönül a.长度通常较大。使| |使用效率非常低
if (string.EndsWith(<1 of N items in a>)==true){//do something}
if (a.Any(yourString.EndsWith))
{
    //your string ends with one of those endings.
}