I’ve been looking for something similar for a while now. I find the If
syntax to be a bit ugly when used merely to check if something is not blank.
I wrote about something similar here:
But I was ultimately dissuaded and instead I landed on:
Here’s a doc showing another place I’d like to use something like this for:
In this doc I propose the idea of IfBlankReturnOtherwiseDo
operator (terrible name, but you get the idea). You would use it in your code like this:
myList.Filter(criterionThatMayYieldNoResults).First().IfBlankReturnOtherwiseDo("", CurrentValue.field)
What possible names | syntax can you think of for the ? operator?
2 Likes