if (!string.IsNullOrEmpty(stringTest))
newString = stringTest; // newString is a string
else
newString = string.Empty;
Is there another (simple) way to achieve this?
You need the Null-coalescence operator:
newString = stringTest ?? String.Empty;
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With