When I try to evaluate the SelectedIndex
of a CheckBoxList
and at bool
. I receive a error on the case in my switch statement in C#. The error is Constant value '0' cannot be converted to a 'bool'
. Is there a way that I can evaluate both with in a switch statement? I know I can use a if statement, but I would rather use a switch statement if I could.
Here is my code:
switch ((CBL_PO.SelectedIndex == 0) && (boolIsNotValid == true))
{
case 0: case true:
//Do Something
break;
}