I'm facing the problem that C# in my case can't cast the number 1 to bool. In my scenario (bool)intValue doesn't work. I get an InvalidCastException. I know I can use Convert.ToBoolean(...) but I'm just wondering it doesn't work. Any explanation for this?
My code is
if (actualValueType.Name == "Boolean" || setValueType.Name == "Boolean")
{
if ((bool)actualValue != (bool)setValue)
...
}