[Solved] CS0030: Cannot convert type ‘int’ to ‘bool’ [closed]


this.gridViewCastles.SetRowCellValue(rowHandle, column, (object) (bool) (flag2 ? 1 : 0));

What are you trying to do?

Flag2 is a boolean. The ?: operator allows you to test a boolean condition to select one of two possible vaules, in your case, 0 and 1. In your code, you try to cast 0/1 to boolean. What is the reason for using the ?: operator? Just type this:

this.gridViewCastles.SetRowCellValue(rowHandle, column, (object) flag2);

solved CS0030: Cannot convert type ‘int’ to ‘bool’ [closed]