Is there a way to get the index of a item within a List with case insensitive search?
List<string> sl = new List<string>() { "a","b","c"};
int result = sl.IndexOf("B"); // should be 1 instead of -1
Try this : So there is no direct way to use IndexOf with String Comparison option for LIST, to achieve desire result you need to use Lambda expression.
int result = sl.FindIndex(x => x.Equals("B",StringComparison.OrdinalIgnoreCase));
The IndexOf method for Strings in C# has a ComparisonType argument, which should work something like this:
sl.IndexOf("yourValue", StringComparison.CurrentCultureIgnoreCase)
or
sl.IndexOf("yourValue", StringComparison.OrdinalIgnoreCase)