When converting a statement from VB.net to C# including a ternary if operator, the code might not work correctly due to the missing parenthesis:
Original code:
Function test(value As Boolean) As String
Return "*" & If(value, "Yes", "No") & "*"
End Function
Converted (doesn't compile)
public string test(bool value)
{
return "*" + value ? "Yes" : "No" + "*";
}
Expected
public string test(bool value)
{
return "*" + (value ? "Yes" : "No") + "*";
}