I want to find index of a character in char Array. I wrote below code, but I want
to use some library function/ LINQ to find the index rather than manually looping
through it. Is there any smarter way/ concise way I can achieve it.
Attempt:
var index = -1;
char[] x = { 'A', 'B', 'C', 'D' , 'E'};
for(int t = 0; t< x.Length; t++)
{
if (x[t] == 'E')
index = t;
}
Console.WriteLine($"Index is: {index}");