Tips for Converting
your
VB.Net Project to C#:
Make sure your program compiles and all references are resolved in
your VB.Net project before conversion. If your VB.Net project
won't compile, the conversion quality will be severely degraded.
Clean up your code prior to conversion. C# is much more strict
than Visual Basic and as the old saying goes, an ounce of prevention is worth
a pound of cure.
Turn Option Explicit and Option Strict On and fix any compiler errors.
This is very important as C# requires all variables and variable types
to be declared.
Replace any complicated On Error logic with Try / Catch statements.
Simple On Error Goto logic will be automatically converted to C#
Try / Catch logic, but complicated On Error logic won't.
If you wrote any of your code outside of Visual Studio, open and
reformat it in Visual Studio. The Visual Studio editor corrects
most casing inconsistencies. VB.Net isn't case sensitive but C#
is. The converter should fix most casing inconsistencies for you
automatically, but if all your code was written in Notepad it can
sometimes cause problems.
Pay attention to the Critical and High priority warnings VBConversions
gives you when it analyzes your code. They generally must be fixed
in your VB code prior to conversion.
Converting large projects are
challenging using any tool. Here are some tips for converting large
projects:
Get a fast computer with a lot of memory. One of the reasons
VBConversions is so accurate is that a lot of analysis has to be
done on the VB project to be converted. Large projects can
take a long time to convert and require a lot of memory.
If at all possible, subdivide a big project into many smaller
projects. This makes the conversion process more manageable
and will also improve the quality of the conversion.
Again, turn Option Explicit and Option Strict On and clean up the code before
converting. This can be a pain with large projects, but not nearly
as painful as correcting code after the conversion.
|