1
Answer

Comparing two Chars?

Aaron

Aaron

16y
2k
1

I am trying to compare two characters.  I can watch the charTemp array fill up and when it gets to the character I am comparing it to, it just bypasses it as if they are not equal.  The code is as follows.  Am I comparing them incorrectly?  Do I need to compare the decimal value or something?

EDIT: This ((char)tr.Read() == '&') which is right above it works fine. And I have initialized the char array as:

char[] charTemp = new char[50];


while (charTemp[i] != '%')
{
   charTemp[i] = (
char)tr.Read();
   
i++;
}

Thanks
Aaron

Answers (1)