Find array index by ignorecase

arrays, c#, string

Solution

By using `FindIndex` and a little lambda.

var ar = new[] { "hi", "Hello" };
var ix = Array.FindIndex(ar, p => p.Equals("hello", StringComparison.CurrentCultureIgnoreCase));

Problem

Possible Duplicate: How to add a case-insensitive option to Array.IndexOf ``` int index1 = Array.IndexOf(myKeys, "foot"); ``` Example I have `FOOT` in my array list, but it will return value of `index1 = -1`. How can I find index of `foot` by ignoring the case?

Original source

Related problems