Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
C# Equivalent To VFP DO CASE
Message
Information générale
Forum:
ASP.NET
Catégorie:
Code, syntaxe and commandes
Divers
Thread ID:
00972871
Message ID:
00972880
Vues:
18
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
Thanks,

TFISHER
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform