Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How do i say is not, is not

i don't want to say:

(trsaz != v1) && (trsaz != v2) && ...

i want something like:

trsaz != (v1, v4, v7, v11)

Is this possible or is there also something else besides !=.

like image 596
divfe Avatar asked Jun 01 '11 01:06

divfe


2 Answers

var badList = new[] { v1, v4, v7, v11 };
var result = !badList.Contains(trsaz);
like image 111
Bala R Avatar answered Oct 30 '22 09:10

Bala R


var excludeList = new[] { "v1", "v4", "v7", "v11" };
if(!excludeList.Contains(trsaz))
{
    ...
}
like image 32
Alex Aza Avatar answered Oct 30 '22 09:10

Alex Aza