我有一根绳子
string str="hello";
这是我的数组
string[] myarr = new string[] {"good","Hello", "this" , "new"};
我需要从数组中查找"hello"的索引(不使用循环)
所以我用了
int index = Array.IndexOf(myarr, str);
返回-1,但我希望结果为1.
我甚至试过StringComparer.OrdinalIgnoreCase
个,但都没有用.
希望有人能帮忙.谢谢