+ 1
Why do I get this error : Cannot apply indexing with [] to an expression of type 'char'
I have a for-loop and I want to iterate through all characters of the string (userInput) for(int i=0; i < userInput.Length;i++) // each (char ch in userInput) { ch = userInput[i]; } Now I get the following error : Cannot apply indexing with [] to an expression of type 'char' If a string is a array, I should be able to use a indexer, why do I get this error ?
2 Answers
+ 5
so true đ i guess if the compiler fixed its self it could make a human error
+ 3
Sorry, Error does not apply to the line. I mentioned.
Problem solved.
Why are compilers always right but never clear.