Can you set a condition inside the string.format parameter.
So if i have
string.format("{0}" , if x = 7 then return "SEVEN" else return "ZERO")
Is there a way of doing this?
With a ternary operator in VB.Net:
String.Format("{0}", If(x = 7, "SEVEN", "ZERO"))
Same in C# (as Brad already posted):
String.Format("{0}", x == 7 ? "SEVEN" : "ZERO")
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