c# - other way to check if value is null or empty and assign value -
if (!string.isnullorempty(stringtest)) newstring = stringtest; // newstring string else newstring = string.empty;
is there (simple) way achieve this?
you need null-coalescence operator:
newstring = stringtest ?? string.empty;
Comments
Post a Comment