检查字符串数组中的任何项目?

Joh*_*ohn -1 c# asp.net asp.net-mvc

static void Main(string[] args)
{ 
    if (args[0].ToUpper().Equals("DOWNLOADPOS"))
    {
        DownloadPOS();
    }
Run Code Online (Sandbox Code Playgroud)

将运行DownloadPOS(),如果args中的第一项是downloadpos,我想检查args中的所有项目?请指教?

我以前用过:

//if (args.Contains(pos))
//{
//    DownloadPOS();
//}
Run Code Online (Sandbox Code Playgroud)

但后来不确定如何确定它上面

谢谢

Bar*_*ers 5

if (arg.Any(x => x.Equals("DOWNLOADPOS", StringComparison.OrdinalIgnoreCase)))
{
    DownloadPos();
}
Run Code Online (Sandbox Code Playgroud)

如果您需要支持特殊文化(例如土耳其语),请使用StringComparison.InvariantCultureIgnoreCase而不是StringComparison.OrdinalIgnoreCase