I tried the following:
(id == title) | (id.IsNullOrEmpty) ? "class='enabled'" : ""
But it gives a message saying “Error 22 Operator ‘|’ cannot be applied to operands of type ‘bool’ and ‘method group’
Can anyone tell me what’s wrong. Both id and title are strings.
You’re using bitwise OR (|). You need logical OR (||).
Note that the equality operator (==) is case sensitive. To do a case insensitive comparison use the static method String.Compare.