I want to check if the user input is in my array. If it's not it shall write "Invalid input". The line reading already works. I just want to check this. But like I did it, it doesn't work. I heard that I shall use a for loop. But how?
[...]
char[] menuChars = { 'e', 'E', 'l', 'L', 'k', 'K', 't', 'T', 's', 'S', 'b', 'B' };
if (userKeyPress == !menuChars)
{
Console.WriteLine("Please insert a valid char: ");
}
Console.ReadLine()
[...]
if(!menuChars.Contains(userKeyPress))?menuCharsis a one-dimensional zero-indexed array, you will have to do eitherif (Array.IndexOf(menuChars, userKeyPress) == -1)orif (!((ICollection<char>)menuChars).Contains(userKeyPress)). Those are the .NET 2.0 ways.