Confused about the ? operator in c# -
I want to make it so that if the subs is not the value then the UL is before and after the variable and then the variable ss if subs "" So SL gets value ""
var sL = (subs! = "")? "& Lt; ul & gt;" + Subs + "& lt; / ul & gt;" : ""; But it does not seem to work.
Is my format correct?
In doubt, add more brackets:
var sL = subs ! = ""? ("& Lt; ul & gt;" + subs + "& lt; / ul & gt;"): ""; However, your code should work well in advance; That syntax is OK.
Comments
Post a Comment