Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
X# examples - Readability
Message
De
30/10/2019 02:58:29
 
 
À
Tous
Information générale
Forum:
Visual FoxPro
Catégorie:
VFP Compiler for .NET
Titre:
X# examples - Readability
Divers
Thread ID:
01671739
Message ID:
01671739
Vues:
85
Hi VFPers,

Not sure how many of you were ever frustrated with remembering what Sys(1), Sys(1234) is actually doing. Well X# introduce a new feature that can be used called an Enumerator:
ENUM EditStyle
  MEMBER Add
  MEMBER Edit
  MEMBER Delete
  MEMBER View
END ENUM
Let us consider a generic Form that will behave according to some parameter passed during construction:
CLASS MyForm INHERIT Form
  PROTECTED _Style AS EditStyle
  CONSTRUCTOR(eStyle AS EditStyle)
    SUPER() && Call the base class form constructor
    && A new c# style command SWITCH
    SWITCH eStyle
     CASE EditStyle.Add
     CASE EditStyle.Edit
     CASE EditStyle.Delete
     CASE EditStyle.View
     OTHERWISE
        && Not one of the above
    END SWITCH
  RETURN
END CLASS
Hope this is readable to most.
Johan Nel
George, South Africa
Friend of XSharp (FOX) member
E-mail : johan(dot)nel(at)xsinet(dot)co(dot)za
Web site : https://xsharp.info
X# runtime : https://github.com/X-Sharp/XSharpPublic
Radio talk : https://blog.aksel.com/2019/07/why-xsharp-might-be-tool-foxpro.html
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform