I have a scenario where a form containing a checkbox is submitted, being its element name "someFlag".
If checked, it will come as "on".
If not checked, it will come as empty.
So I'm checking the emptyness of the someFlag
string and assigning the value 1
if it is on
and the value 0
if it is empty.
It works fine but, can this
if (String.IsNullOrEmpty(someFlag))
someFlag= "0";
else
someFlag= "1";
be written in a shorter way?
EDIT
This isn't a duplicate of this question as I'm asking for a solution for a specific scenario, not a broad opinion based question such as the mentioned (it has been closed for that reason). I'm asking a question with two possible answers: yes or no.