I kinda dig this control statement syntax using the tertiary operator (?) (thanks to Bela for pointing it out):
object result =
(<condition A>) ? resultIfA :
(<condition B>) ? resultIfB :
(<condition C>) ? resultIfC :
defaultResult;
I think the reason why I like it is due to the fact that it makes the conditions readable, you don't have to jump through more lines of code... The ugly part is the colon / semi-colon marks at the ends of the lines. What do you think?
Posted
10-29-2007 3:17 PM
by
jgood