Click here to Skip to main content
15,887,267 members

The Weird and The Wonderful

   

The Weird and The Wonderful forum is a place to post Coding Horrors, Worst Practices, and the occasional flash of brilliance.

We all come across code that simply boggles the mind. Lazy kludges, embarrassing mistakes, horrid workarounds and developers just not quite getting it. And then somedays we come across - or write - the truly sublime.

Post your Best, your worst, and your most interesting. But please - no programming questions . This forum is purely for amusement and discussions on code snippets. All actual programming questions will be removed.

 
GeneralRe: Switch boolean.... (reinventing if, unnecessarily) Pin
Simon O'Riordan from UK25-Jun-15 22:09
Simon O'Riordan from UK25-Jun-15 22:09 
GeneralRe: Switch boolean.... (reinventing if, unnecessarily) Pin
ScottM125-Jun-15 22:32
ScottM125-Jun-15 22:32 
GeneralRe: Switch boolean.... (reinventing if, unnecessarily) Pin
Eddy Vluggen25-Jun-15 23:28
professionalEddy Vluggen25-Jun-15 23:28 
GeneralRe: Switch boolean.... (reinventing if, unnecessarily) Pin
Simon O'Riordan from UK25-Jun-15 23:47
Simon O'Riordan from UK25-Jun-15 23:47 
GeneralRe: Switch boolean.... (reinventing if, unnecessarily) Pin
Eddy Vluggen26-Jun-15 0:09
professionalEddy Vluggen26-Jun-15 0:09 
GeneralRe: Switch boolean.... (reinventing if, unnecessarily) Pin
Simon O'Riordan from UK26-Jun-15 0:49
Simon O'Riordan from UK26-Jun-15 0:49 
GeneralRe: Switch boolean.... (reinventing if, unnecessarily) Pin
Scott Corbett26-Jun-15 2:23
Scott Corbett26-Jun-15 2:23 
GeneralRe: Switch boolean.... (reinventing if, unnecessarily) Pin
Richard Deeming26-Jun-15 3:23
mveRichard Deeming26-Jun-15 3:23 
Scott Corbett wrote:
A switch will continue to fall through until you get to a break statement or the end of the switch (i.e. the default case.)

Not in C# - every case is required to have a terminating statement (break, goto, return or throw).

Unlike C++, C# does not allow execution to continue from one switch section to the next.
...
C# requires the end of switch sections, including the final one, to be unreachable. That is, unlike some other languages, your code may not fall through into the next switch section.




"These people looked deep within my soul and assigned me a number based on the order in which I joined."
- Homer


GeneralRe: Switch boolean.... (reinventing if, unnecessarily) Pin
Scott Corbett29-Jun-15 3:14
Scott Corbett29-Jun-15 3:14 
GeneralRe: Switch boolean.... (reinventing if, unnecessarily) Pin
ttennebb26-Jun-15 3:46
professionalttennebb26-Jun-15 3:46 
GeneralRe: Switch boolean.... (reinventing if, unnecessarily) Pin
Simon O'Riordan from UK28-Jun-15 20:07
Simon O'Riordan from UK28-Jun-15 20:07 
GeneralRe: Switch boolean.... (reinventing if, unnecessarily) Pin
mbb0125-Jun-15 23:41
mbb0125-Jun-15 23:41 
GeneralRe: Switch boolean.... (reinventing if, unnecessarily) Pin
Daniel Pfeffer26-Jun-15 0:05
professionalDaniel Pfeffer26-Jun-15 0:05 
GeneralRe: Switch boolean.... (reinventing if, unnecessarily) Pin
Member 990836226-Jun-15 3:08
Member 990836226-Jun-15 3:08 
GeneralRe: Switch boolean.... (reinventing if, unnecessarily) Pin
Basketcase Software26-Jun-15 3:33
professionalBasketcase Software26-Jun-15 3:33 
GeneralRe: Switch boolean.... (reinventing if, unnecessarily) Pin
Javier jimenez Rico26-Jun-15 4:37
professionalJavier jimenez Rico26-Jun-15 4:37 
GeneralRe: Switch boolean.... (reinventing if, unnecessarily) Pin
Member 1159491426-Jun-15 5:19
Member 1159491426-Jun-15 5:19 
GeneralRe: Switch boolean.... (reinventing if, unnecessarily) Pin
DanKorn26-Jun-15 9:23
DanKorn26-Jun-15 9:23 
GeneralRe: Switch boolean.... (reinventing if, unnecessarily) Pin
Member 1159491426-Jun-15 10:22
Member 1159491426-Jun-15 10:22 
GeneralRe: Switch boolean.... (reinventing if, unnecessarily) Pin
DanKorn26-Jun-15 11:03
DanKorn26-Jun-15 11:03 
GeneralRe: Switch boolean.... (reinventing if, unnecessarily) Pin
Member 1159491426-Jun-15 13:15
Member 1159491426-Jun-15 13:15 
GeneralRe: Switch boolean.... (reinventing if, unnecessarily) Pin
Al Chak27-Jun-15 22:01
Al Chak27-Jun-15 22:01 
GeneralRe: Switch boolean.... (reinventing if, unnecessarily) Pin
Richard Deeming29-Jun-15 2:25
mveRichard Deeming29-Jun-15 2:25 
GeneralRe: Switch boolean.... (reinventing if, unnecessarily) Pin
chaosworrier_oz29-Jun-15 17:55
chaosworrier_oz29-Jun-15 17:55 
GeneralRe: Switch boolean.... (reinventing if, unnecessarily) Pin
TheGreatAndPowerfulOz30-Jun-15 9:13
TheGreatAndPowerfulOz30-Jun-15 9:13 

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.