Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
X# examples - Readability
Message
From
30/10/2019 02:58:29
 
 
To
All
General information
Forum:
Visual FoxPro
Category:
VFP Compiler for .NET
Title:
X# examples - Readability
Miscellaneous
Thread ID:
01671739
Message ID:
01671739
Views:
86
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
Next
Reply
Map
View

Click here to load this message in the networking platform