Click here to Skip to main content
15,882,830 members
Home / Discussions / C#
   

C#

 
AnswerRe: Convert Dictionary Net 4.0 to Net 2.0 ? Pin
Pete O'Hanlon19-Jan-17 21:32
mvePete O'Hanlon19-Jan-17 21:32 
JokeC# parser Pin
alfcas19-Jan-17 3:56
alfcas19-Jan-17 3:56 
GeneralRe: C# parser Pin
Pete O'Hanlon19-Jan-17 4:17
mvePete O'Hanlon19-Jan-17 4:17 
GeneralRe: C# parser Pin
Eddy Vluggen19-Jan-17 4:37
professionalEddy Vluggen19-Jan-17 4:37 
GeneralRe: C# parser Pin
Daniel Pfeffer19-Jan-17 4:47
professionalDaniel Pfeffer19-Jan-17 4:47 
GeneralRe: C# parser Pin
OriginalGriff19-Jan-17 4:52
mveOriginalGriff19-Jan-17 4:52 
GeneralRe: C# parser Pin
Daniel Pfeffer19-Jan-17 5:07
professionalDaniel Pfeffer19-Jan-17 5:07 
GeneralRe: C# parser Pin
OriginalGriff19-Jan-17 4:49
mveOriginalGriff19-Jan-17 4:49 
If you look at the C# l;anguage specification (it's included with most versions of VS: %Program Files (x86)%\Microsoft Visual Studio x.y\VC#\Specifications\1033) the switch is defined as:
switch-statement:
   switch   (   expression   )   switch-block

switch-block:
   {   switch-sectionsopt   }

switch-sections:
   switch-section
   switch-sections   switch-section

switch-section:
   switch-labels   statement-list

switch-labels:
   switch-label
   switch-labels   switch-label
switch-label:
      case   constant-expression   :
      default   :
So there is no explicit requirement that the switch expression be variable probably because it would be limiting: you couldn't then use "length - offset", a delegate, or a method instead of the variable because neither of them is a "variable reference" (or in C and C++ an "lvalue"). And what about Properties where the Setter is private or omitted? They are "constants" as well... Laugh | :laugh:

Why should that not be a constant? I don't have a problem with that myself - and this from someone whose default project settings are always "Warning Level 4" and "Treat warnings as errors" because the only time it could be confusing is if the value is 0 or 1 and could be mistaken for a single character variable name - which is a bigger crime in my book outside a for-loop control variable! Laugh | :laugh:
Bad command or file name. Bad, bad command! Sit! Stay! Staaaay...

QuestionSSD Computer and Visual Studio 2015... Pin
wtf3218-Jan-17 19:11
wtf3218-Jan-17 19:11 
AnswerRe: SSD Computer and Visual Studio 2015... Pin
Pete O'Hanlon18-Jan-17 19:19
mvePete O'Hanlon18-Jan-17 19:19 
AnswerRe: SSD Computer and Visual Studio 2015... Pin
OriginalGriff18-Jan-17 20:28
mveOriginalGriff18-Jan-17 20:28 
AnswerRe: SSD Computer and Visual Studio 2015... Pin
Nathan Minier19-Jan-17 1:22
professionalNathan Minier19-Jan-17 1:22 
AnswerRe: SSD Computer and Visual Studio 2015... Pin
Eddy Vluggen19-Jan-17 1:51
professionalEddy Vluggen19-Jan-17 1:51 
GeneralRe: SSD Computer and Visual Studio 2015... Pin
wtf3219-Jan-17 2:26
wtf3219-Jan-17 2:26 
AnswerRe: SSD Computer and Visual Studio 2015... Pin
Gerry Schmitz19-Jan-17 5:27
mveGerry Schmitz19-Jan-17 5:27 
QuestionWinforms custom property fails to reload - continued from QA Pin
Midi_Mick18-Jan-17 3:53
professionalMidi_Mick18-Jan-17 3:53 
AnswerRe: Winforms custom property fails to reload - continued from QA Pin
Gerry Schmitz18-Jan-17 4:47
mveGerry Schmitz18-Jan-17 4:47 
GeneralRe: Winforms custom property fails to reload - continued from QA Pin
Midi_Mick18-Jan-17 4:54
professionalMidi_Mick18-Jan-17 4:54 
GeneralRe: Winforms custom property fails to reload - continued from QA Pin
Gerry Schmitz18-Jan-17 5:19
mveGerry Schmitz18-Jan-17 5:19 
GeneralRe: Winforms custom property fails to reload - continued from QA Pin
Midi_Mick18-Jan-17 5:34
professionalMidi_Mick18-Jan-17 5:34 
QuestionRe: Winforms custom property fails to reload - continued from QA. A new clue. Pin
Midi_Mick18-Jan-17 4:48
professionalMidi_Mick18-Jan-17 4:48 
QuestionWhen is it safe to use Monitor (lock) with Task? Pin
Bernhard Hiller18-Jan-17 2:34
Bernhard Hiller18-Jan-17 2:34 
AnswerRe: When is it safe to use Monitor (lock) with Task? Pin
Pete O'Hanlon18-Jan-17 3:25
mvePete O'Hanlon18-Jan-17 3:25 
GeneralRe: When is it safe to use Monitor (lock) with Task? Pin
Bernhard Hiller18-Jan-17 21:05
Bernhard Hiller18-Jan-17 21:05 
AnswerRe: When is it safe to use Monitor (lock) with Task? Pin
Richard Deeming18-Jan-17 8:11
mveRichard Deeming18-Jan-17 8:11 

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.