Shorthand nullable variable assignment in C# [duplicate]
This question already has answers here: Nullable types and the ternary operator: why is `? 10 : null` forbidden? [duplicate] (9 answers) Closed 3 hours ago. In my C# WPF project I am trying to assign a value to nullable short with the shorthand function: short? var = (textbox.Text.Length > 0) ? short.Parse(textbox.Text) : null; […]
Shorthand nullable variable assignment in C# [duplicate]
This question already has answers here: Nullable types and the ternary operator: why is `? 10 : null` forbidden? [duplicate] (9 answers) Closed 3 hours ago. In my C# WPF project I am trying to assign a value to nullable short with the shorthand function: short? var = (textbox.Text.Length > 0) ? short.Parse(textbox.Text) : null; […]