c# - How to do a quick inline method with conditional? -
this i'd do:
string x = if(true) "string val" else "no string val";
is possible?
what you're talking called conditional statement:
string x = boolval ? "string val" : "no string val";
if want string have no value if bool false, change to:
string x = boolval ? "string val" : null;
Comments
Post a Comment