mardi 7 mars 2017

Flexible if condition in c#

I have 7 checkboxes and i have 7 variables. (cbxA, cbxB.... cbxG and iA,iB...iG). And i want to to this:

List<int> iList=new List<int>();
for (int i=0;i<100;i++)
{
   if (cbxA.checked && cbxB.checked) 
   {
      if (i<iA && i<iB)
      {
          iList.add(i);
      }  
   }
   //. . . i want to do like that. 
}

I mean if cbxB and cbxC and cbxE checked then my if line should be like below:

      if (i<iB && i<iC && i<iE)
      {
          iList.add(i);
      }

How can i do that? Thank you in advance.

Aucun commentaire:

Enregistrer un commentaire