This is what I'd like to do:
string x = if(true) "String Val" else "No String Val";
Is that possible?
What you're talking about is called a conditional statement:
string x = boolVal ? "String Val" : "No String Val";
If you really want the string to have no value if the bool is false, you could change to:
string x = boolVal ? "String Val" : null;
string x = condition ? trueValue : falseValue;
http://msdn.microsoft.com/en-us/library/ty67wk28.aspx
Copyright © 2021 Jogjafile Inc.
What you're talking about is called a conditional statement:
If you really want the string to have no value if the bool is false, you could change to: