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

Popular posts from this blog

javascript - Enclosure Memory Copies -

php - Replacing tags in braces, even nested tags, with regex -