Click here to Skip to main content
15,564,935 members
Home / Discussions / C#
   

C#

 
QuestionA matter of style : Switch or ?: [modified] Pin
mgkr20-Oct-09 1:18
mgkr20-Oct-09 1:18 
AnswerRe: A matter of style : Switch or ?: Pin
OriginalGriff20-Oct-09 1:31
mvaOriginalGriff20-Oct-09 1:31 
AnswerRe: A matter of style : Switch or ?: Pin
Christian Graus20-Oct-09 1:39
mveChristian Graus20-Oct-09 1:39 
AnswerRe: A matter of style : Switch or ?: Pin
Simon P Stevens20-Oct-09 1:40
Simon P Stevens20-Oct-09 1:40 
AnswerRe: A matter of style : Switch or ?: Pin
Jacobb Michael20-Oct-09 1:42
Jacobb Michael20-Oct-09 1:42 
AnswerRe: A matter of style : Switch or ?: Pin
Pete O'Hanlon20-Oct-09 1:42
mvaPete O'Hanlon20-Oct-09 1:42 
AnswerRe: A matter of style : Switch or ?: Pin
nagendrathecoder20-Oct-09 1:50
nagendrathecoder20-Oct-09 1:50 
AnswerThank you all - Switch it is. Pin
mgkr20-Oct-09 2:06
mgkr20-Oct-09 2:06 
@OriginalGriff
Fixed the switch for ya Poke tongue | ;-P

clarity and readability are much more important than saving space on screen.
Agreed 100%

Which is why I posted - As the ?: was/is very clear to me, and I can at a glance understand what's going on, but I'm well aware it's not a construct used that/as often, so wanted to test the waters with other coders.


-debugging nested ternary's is an absolute nightmare
-I'll go for Switch because its easy to track errors in that.
Good point
As this is a *very* simple case I didn't even think of that actually.
But it might need to get more complicated as the code evolves.
Where I'm using it, it's not very likely though - But those are "famous last words", so point taken and agreed to.

--

Thank you all for the feed back - I'll tidy up my code now Cool | :cool:
AnswerRe: A matter of style : Switch or ?: Pin
N a v a n e e t h20-Oct-09 2:06
N a v a n e e t h20-Oct-09 2:06 
AnswerRe: A matter of style : Switch or ?: Pin
Keith Barrow20-Oct-09 2:10
professionalKeith Barrow20-Oct-09 2:10 
GeneralRe: A matter of style : Switch or ?: Pin
PIEBALDconsult20-Oct-09 7:07
professionalPIEBALDconsult20-Oct-09 7:07 
AnswerRe: A matter of style : Switch or ?: Pin
Nisha Agrawal20-Oct-09 2:14
Nisha Agrawal20-Oct-09 2:14 
GeneralRe: A matter of style : Switch or ?: Pin
PIEBALDconsult20-Oct-09 7:04
professionalPIEBALDconsult20-Oct-09 7:04 
AnswerRe: A matter of style : Switch or ?: Pin
Luc Pattyn20-Oct-09 2:53
sitebuilderLuc Pattyn20-Oct-09 2:53 
GeneralRe: A matter of style : Switch or ?: Pin
PIEBALDconsult20-Oct-09 6:49
professionalPIEBALDconsult20-Oct-09 6:49 
AnswerRe: A matter of style : Switch or ?: Pin
PIEBALDconsult20-Oct-09 6:56
professionalPIEBALDconsult20-Oct-09 6:56 
QuestionHow to lock the column width expansion in list view at run time Pin
@nisha 2n20-Oct-09 0:21
@nisha 2n20-Oct-09 0:21 
AnswerRe: How to lock the column width expansion in list view at run time Pin
Jacobb Michael20-Oct-09 2:48
Jacobb Michael20-Oct-09 2:48 
GeneralRe: How to lock the column width expansion in list view at run time Pin
SimpleData20-Oct-09 6:57
SimpleData20-Oct-09 6:57 
QuestionRegular Expression ? Pin
Jacobb Michael20-Oct-09 0:07
Jacobb Michael20-Oct-09 0:07 
AnswerRe: Regular Expression ? Pin
Eddy Vluggen20-Oct-09 2:29
professionalEddy Vluggen20-Oct-09 2:29 
GeneralRe: Regular Expression ? Pin
Jacobb Michael20-Oct-09 2:58
Jacobb Michael20-Oct-09 2:58 
GeneralRe: Regular Expression ? Pin
Eddy Vluggen20-Oct-09 3:02
professionalEddy Vluggen20-Oct-09 3:02 
GeneralRe: Regular Expression ? Pin
Jacobb Michael20-Oct-09 3:13
Jacobb Michael20-Oct-09 3:13 
GeneralRe: Regular Expression ? Pin
J4amieC20-Oct-09 3:38
J4amieC20-Oct-09 3:38 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.