-
Notifications
You must be signed in to change notification settings - Fork 33
Proscriptions & C# isms
Benjamin edited this page Mar 14, 2020
·
6 revisions
What C# can't do that VB6 can
-
Optional ByRef
- There is no equivalent in C#. There are ways you can try to work around this, such as overloaded function signatures, etc, but, in general, try to refactor away from this generally considered bad programming practice.
-
With
- Convenient, but not supported by any language but VB6. In the majority of cases, a temp variable can be substituted, but in wider usage, the VB6 syntax allowed the use of this with functions that returned a value. This is harder to catch up to.
- In general, try to refactor away from the use of
With
when you decide to convert to VB6. It's tempting to simply let the converter do it, but you wont be happy with the variable name choice anyway. You'll just have to refacgtor it manually in the end to make the variable names make sense. Use the linter to detectWith
usage in VB6.
Some things to be aware of in C# that we make use of (2017 version)
- True classes. You will need to understand OO programming and you should have some working knowledge of C#.
- We chose WPF. While WinForms might be more congruent to VB6, it is largely unsupported. We wanted to be able to use the same higher end graphics that we had worked to implmeent in VB6, so WPF was the only real choice for us. VB6 are converted to XAML, and can be edited in the VS GUI.
- Extension Functions
- You can add a function to a class without changing the class itself. This is called an "Extension Function". We use these.
- We would have loved to use C#'s proposed "Extension Properties", and saved a lot of conversion, but they were not available yet.