I am reading the following code in vb6
If someInteger Then
DoSomething
End If
I don’t know if it means
someInteger == 1,someInteger > -1,someInteger > 0orConvert.ToBoolean(someInteger)
What’s the equivalent expression in C#?
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.
That is explained here. It’s about VB.NET, but that behavior is unchanged from VB6.
Basically,
If someInteger Then ...is equivalent toIf someInteger <> 0 Then ..., so everything that is not zero isTrue, be it, 1, 2, -1, etc.