mercredi 29 avril 2015

Compare multiple values in one condition

Int32 int1, int2, int3 = 123;

Given the above variables, how can I test that all of my variables have the value 123 without creating a colletion to perform some Any or something on?

What I've Tried

if(int1 == int2 == int3 == 123)
{
   // Fantastic code here
}

I'm disappointed to see that the above won't compile, it would've been a nice way of comparing all to one value.

Aucun commentaire:

Enregistrer un commentaire