Better way to write IF conditions
I have an object, lets say serviceData that has a nullable boolean property, lets call it Potato. I want to create a string that says
yes if Potato is true and
no if Potato is false.
string potato= "";
if (serviceData.Potato == true)
potato = "Yes";
if (serviceData.Potato == false)
potato = "No";
Any better way to do this?
var potato= (serviceData.Potato == true ? 'Yes' : 'No');
Thanks it worked! - Ahmed Ali ♦
Feel free to discuss about question, here!
Any suggestions? - Ahmed Ali ♦