lundi 22 décembre 2014

Or in IF statement not working properly

I have this Or condition in an IF statement (in a foreach loop) in a Windows Form C# program:



if ((splittedFile.Count() != 3) || (splittedFile.Count() != 4))
continue;


and it always does continue, even if splittedFile.Count() is 3 or 4. The thing is that if I remove the Or condition:



if ((splittedFile.Count() != 4))
continue;


it works properly!! Any ideas why?


Aucun commentaire:

Enregistrer un commentaire