shorthand-if

Shorthand if + nullable types (C#)

The following returns Type of conditional expression cannot be determined because there is no implicit conversion between 'double' and '<null>' aNullableDouble = (double.TryParse(aString, out aDouble)?aDouble:null) The reason why I can't just use aNullableBool instead of the roundtrip with aDouble is because aNullableDouble is...

Short hand if statment

Is there a shorter version of the following: Using ASP.NET MVC, this is in the HTML page <%= IsTrue ? Html.Image("~/images/myimage.gif") : "" %> I know I'm only really writing 3 extra characters, just wondering if there is something better. ...

How do I use shorthand if / else?

I've tried using the examples from this page, but I can't output any results. This is my IF statement that works: if (!empty($address['street2'])) echo $address['street2'].'<br />'; And this is my none-working shorthand code $test = (empty($address['street2'])) ? 'Yes <br />' : 'No <br />'; // Also tested this (empty($address['stre...