The current rule states:
In the interests of keeping code clean, the simplest possible conditional syntax should be used. That means
- […]
- using the ternary operator
?:
for assignment to a single variable.
Can we extend this to
using the ternary operator ?:
for assignment to a single variable or a single line of code.
…or something similar.
The problem is, enforcing the current rule would make LINQ code, which regularly uses up multiple lines (eg. to make multiple conditions more readable), less readable.
See this example:
would convert to