First if condition
if(Txt1.Text != "" && Txt2.Text != "")
Second if condition
if((Txt1.Text && Txt2.Text) != "")
Is there any diff between these two conditional statement?
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
Yes. The second one is attempting to
&&two strings, and compare the result to the empty string. I don’t believe this is valid C#, as no&&operator overload exists for two strings.I appreciate your desire for terseness, but the first one is really what you want.