Simple if OR in c#

Ok, Total noob at c# here… But how do you do if OR?

I have



if(id = 1 || id2 = 2){

 //do this
}


and I keep getting Specified cast is not valid.

Thanks!

You need double equals.
A single equals is assign, double equals is logical compare.



if(id == 1 || id2 == 2){

 //do this
}

What you were doing was assigning the values. What you want to be doing is comparing. = vs. ==

Good Luck!

To repeat what foolios said:

You’re using “=” when you should be using “==”