C# Simple IF OR question

Posted by Jamie on Stack Overflow See other posts from Stack Overflow or by Jamie
Published on 2010-05-24T12:53:28Z Indexed on 2010/05/24 13:01 UTC
Read the original article Hit count: 210

Filed under:

Hi all,

Sorry to ask this as I thought I knew the answer, I want to exit the program if userName is greater than 4 characters or userName is not an account called student. However this even if the userName is only 3 characters and is not student I'm still hitting Application.Exit. What am I doing wrong?

        if (userName.Length > 4 | userName != "student")
        {
            Application.Exit();
        }

Shame on me :-(

© Stack Overflow or respective owner

Related posts about c#