FAQ on Instant C# - VB to C# Conversion Utility





























FAQ for Instant C#:

VB to C# Converter

Q:    Is the original VB.NET project altered in any way?
A:    Your existing code is left completely intact.  The new C# project is written to the new location that you specify.
Q:    Do you guarantee a 100% complete conversion?
A:    No.  Our accuracy is the highest in the industry - over 99% (99.98% on Microsoft's "101 Visual Basic Code Samples"), but there will be some minor tweaks required in all but the most trivial projects.  Read the rest of the FAQ to get an idea of a few things that are not converted.  It is critical to try some of your own code when comparing VB.NET to C# converters since it is very easy to create a converter that does very well on a specific set of projects, such as Microsoft's published 101 VB.NET code samples.  Most converters, including Instant C#, are regularly tested against these sample projects.  The most important criterion is how well the converter does on your own code, and this is where Instant C# will clearly show its superiority.
 
Q:    Where can I find sample projects within the 1000-line Demo Edition limit?
A:   Microsoft Visual Studio installs with various VB samples.  As mentioned above, it is far more important to try Instant C# on random selections of your own code - paste elements of your own code (up to 1000 lines) into a test project or paste code snippets (up to 100 lines) directly into the snippet converter.
 
Q:    Does Instant C# convert VB6 projects to C#?
A:    No.  The most effective and safest way to get from VB6 to C# is to use the upgrade wizard included with Visual Studio on your VB6 code, and then use Instant C# on the resulting VB.NET code.  Reproducing the VB6 to VB.NET upgrade as part of Instant C# would just add to the cost of our product and needlessly reproduce something the upgrade wizard already does quite well.
 
Q:    How are methods with optional parameters converted?
A:    Overloaded methods are created and the 'Optional' keywords are removed.  Missing arguments are replaced by the defaults specified by the original VB.NET parameter list.
Q:    How are classic VB Collections handled? 
A:    The .NET Microsoft.VisualBasic namespace is imported as part of the conversion process; allowing your classic VB Collections to continue to work the same way as before.  Instant C# only makes necessary and low-risk changes to your code without rewriting functionality in the Microsoft.VisualBasic namespace.  Converting VB collections to native .NET types would require substantial code alteration and is not necessary to obtain functioning C# code.
Q:    How are classic VB string functions handled?
A:    You have the option of leaving them as is (via reference to the Microsoft.VisualBasic namespace), or converting some of them to their closest .NET equivalent string method. Note that this may be risky if you are depending on some of the very strange quirks of the classic VB string functions (e.g., Left(x, 2) returns an empty string if x is unassigned, while .NET appropriately raises an exception when x.Substring(0, 2) is attempted).
Q:    Are case statements with range expressions handled?
A:    Yes, VB 'Select Case' blocks containing range expressions are converted to C# 'if-else' blocks.  Other 'Select Case' blocks are either converted to C# 'switch' statements if the expressions are constant (a requirement in C#) or to C# if-else blocks otherwise.
 
Q:    What are the most common adjustments necessary after conversion?
A:
●  If the VB.NET project did not have 'Option Strict On' set, then you'll likely have a number of cases where different types are compared with each other - these may need adjustment.
 
●  Although most On Error GoTo statements are converted, some elements of classic VB unstructured error handling (On Error Resume Next, On Error GoTo -1, etc.) are not converted by Instant C#. These statements are marked as a 'ToDo' task. Also, all references to the VB Err object are not converted and marked as a 'ToDo' task.
 
●  Some references to the Microsoft.VisualBasic namespace are left intact (the code will run via references to the .NET Microsoft.VisualBasic namespace).  You have the option of converting many of the .NET Microsoft.VisualBasic methods which have .NET equivalents, but in general Instant C# does not rewrite functionality in the .NET Microsoft.VisualBasic namespace.
●  ‘When’ statements in ‘Catch’ blocks (which have no equivalent in C#) must be manually adjusted.  These are commented out and combined with a warning comment.
Email your questions and comments to:  info@tangiblesoftwaresolutions.com

[Site Map]        [Home]


Copyright © 1997 - 2008 Tangible Software Solutions Inc.