如何找到一个字符串数组是否包含字符串的某些部分? 我有这样C#数组包含部分
String[] stringArray = new [] { "[email protected]", "[email protected]", "@gmail.com" };
string str = "[email protected]"
if (stringArray.Any(x => x.Contains(str)))
{
//this if condition is never true
}
阵列我想运行此如果块时STR包含字符串多数民众赞成完全或任何阵列的项目的一部分。
看到使用我的更新代码的片段,但它不工作。 – coure2011 2010-07-23 16:30:48
乔恩的代码在这里工作得很好。你从你的例子中错过了一些东西。 – 2010-07-23 16:34:56
请立即结帐我更新的代码。 – coure2011 2010-07-23 18:13:42