Syntax:
<result> = <condition> ? <true result> : <false result>;
Example:
string result = 5 > 10 ? "5 is greater than 10." : "5 is not greater than 10.";
Response.Write(result);
Result:
5 is not greater than 10.
L.
One Line IF Statement in C#
Lerrie | Friday, September 23, 2011 | Labels: ASP.NET, C#, IF, Visual Studio
Subscribe to:
Post Comments (Atom)





0 comments:
Post a Comment