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

php - How to build a web site which gives a sub-domain dynamically to every registered user? -

android - View with visibility state GONE taking up space on screen -