Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
C# Equivalent To VFP DO CASE
Message
General information
Forum:
ASP.NET
Category:
Coding, syntax and commands
Miscellaneous
Thread ID:
00972871
Message ID:
00972887
Views:
16
The switch statement can only evaluate 1 expression, unlike the VFP case statement. the exact match to vfp case would be if... else if.. else.. statement block.

HTH.

>Hi Kevin,
>
>You may wish to use the Switch statement.
>
>There is an example and explanation here:
>
>http://msdn.microsoft.com/library/default.asp?url=/library/en-us/csspec/html/vclrfcsharpspec_8_7_2.asp
>
>The switch statement selects for execution a statement list having an associated switch label that corresponds to the value of the switch expression.
>
>
>switch-statement:
>  switch   (   expression   )   switch-block
>switch-block:
>  {   switch-sections opt   }
>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   :
>
>
>
>Hope this helps.
>
>TFISHER
>
>>I am trying to convert some strings based on conditions. In VFP I would do something like:
>>
>>
>>DO CASE
>>CASE condition a
>>   && code here
>>CASE condition b
>>   && code here
>>OTHERWISE
>>   && code here
>>ENDCASE
>>
>>
>>How would this be coded in C#?
>>
>>TIA, Kevin
Previous
Reply
Map
View

Click here to load this message in the networking platform