SyntaxFix
Write A Post
Hire A Developer
Questions
You can achieve this with pattern matching with the switch expression in C#8/9
FooTextBox.Text = strFoo switch { { Length: >0 } s => s, // If the length of the string is greater than 0 _ => "0" // Anything else };