J
John A Grandy
Often in dbs , tinyint is used instead of int (because tinyint cols may be
indexed , whereas int cols may not).
What is the best way to convert integers to booleans ?
The following fails:
bool myBool;
tinyint myTinyInt = 1;
myBool = (bool) myTinyInt;
If you have restricted your integers are restricted to 0 , 1, then the
following works, but is difficult to read:
myBool = (myTinyInt == 1);
indexed , whereas int cols may not).
What is the best way to convert integers to booleans ?
The following fails:
bool myBool;
tinyint myTinyInt = 1;
myBool = (bool) myTinyInt;
If you have restricted your integers are restricted to 0 , 1, then the
following works, but is difficult to read:
myBool = (myTinyInt == 1);