if we use is keyword to detect if object is of type in this case bool.
Code is decompiled incorrectly with as keyword.
Original Code:
public object Convert(object[] values)
{
string str = "";
bool IsBool = values[2] is bool; // if IsBool not in use (see commented line) decompiled : object obj = values[2];
if (values != null
&& (int)values.Length == 3
&& (values[2] is bool)
&& (bool)values[2]
&& values[0] is Color
&& values[1] is Color)
{
Color color = (Color)values[0];
Color color1 = (Color)values[1];
}
// object oo = (object)IsBool; // any use
return str;
}
}
public object Convert(object[] values)
{
string str = "";
object obj = values[2];
if (values != null && (int)values.Length == 3 && values[2] as bool && (bool)values[2] && values[0] is Color && values[1] is Color)
{
Color color = (Color)values[0];
Color color1 = (Color)values[1];
}
return str;
}
make notice of
object obj = values[2];
if we in original code used anywhere IsBool variable it would decompile properly is keyword in above line:
bool flag = values[2] is bool;
but still strange that no use of object decompiles as object instead of bool (I would still say this is bug, but we can live with it).