score:2

Accepted answer

you can use following conditional operator:

txt_objective.text = dtreqmas.rows[0].isnull("objective") 
                     ? string.empty : dtreqmas.rows[0].field<string>("objective");

score:0

try this

txt_objective.text = (dtreqmas!=null && dtreqmas.rows.count>0 && !string.isnullorempty(dtreqmas.rows[0]["objective"])?dtreqmas.rows[0]["objective"].tostring():string.empty;

score:1

i think, this may helpful for you:

txt_objective.text = (string.isnullorempty(dtreqmas.rows[0]
["objective"].tostring()) ? string.empty : dtreqmas.rows[0]
["objective"].tostring().trim());

score:7

this should work:

txt_objective.text = (dtreqmas.rows[0]["objective"] ?? string.empty).tostring().trim();

Related Query