Answers for "c# string ternary operator string interpolation"

C#
1

A conditional expression cannot be used directly in a string interpolation because the ':' ends the interpolation. Parenthesize the conditional expression.

var result = $"Descending {(isDescending ? "yes" : "no")}";
Posted by: Guest on January-28-2021

C# Answers by Framework

Browse Popular Code Answers by Language