Can these ternary expression with expensive method calls be simplified without outline variables ...
I do NOT want to
- call expensive methods more than once.
- make "outline" temporary variables. Outline variables are ones declared outside ternary expressions.
- leak variables with letters.
where
bool? ExpensiveMethod*<T,U>(T t, U u){}
.
Can these expression be simplified even further?6 Replies
not enough information
what do those methods return?
conditional access operator and null coalescing operator
var out1 = ExpensiveMethod1(x, y)?.ToString() ?? "null";
✅ SOLVED
$close
Use the /close command to mark a forum thread as answered
$close
Use the /close command to mark a forum thread as answered