I have a string
string str="hello";
This is my array
string[] myarr = new string[] {"good","Hello", "this" , "new"};
I need to find the index of "hello" from the array (Without Using a Loop)
So i have used
int index = Array.IndexOf(myarr, str);
This returns -1 ,But i am expecting result as 1.
I have even tried with StringComparer.OrdinalIgnoreCase
but no avail.
Hope someone can help. Thanks.
See Question&Answers more detail:os