I have this List:
List<string> headers = new List<string>();
headers.Add("Red");
headers.Add("Blue");
headers.Add("Green");
headers.Add("Black");
And I have this function:
private int getColorIndex(string colorName , List<string> headers)
{
int index = LINQ;
}
In getColorIndex
function I want to write LINQ that returns the index of specific color from headers list(in colorName variable).
For example if colorName is black the value of index will be 3.
The colorName
can contain big or small letters.
For example:
colorName = Black or colorName = black
Any idea how can I write this LINQ?