csharpier
csharpier copied to clipboard
Potential new ternary formatting
The current formatting of nested ternary operators
var languageCode = something.IsNotBlank()
? something
: otherThing.IsNotBlank()
? otherThing
: thingThing.IsNotBlank()
? thingThing
: "enUs";
If that were to change to this, then I believe it becomes a lot more readable.
var languageCode =
something.IsNotBlank() ? something
: otherThing.IsNotBlank() ? otherThing
: thingThing.IsNotBlank() ? thingThing
: "enUs";
Would also need to consider what to do if someone creates a statement like this
var x = firstCondition
? secondCondition
? firstValue
: secondValue
: thirdCondition
? thirdValue
: fourthValue;