Differences and Limitations
Mercury strives for 99% backward compatibility with Microsoft Visual Basic.NET so that ideally every existing VB project can be opened and built (for the .NET platform only, of course) with no or very minor adjustments.
This section covers some of the smaller differences that you might encounter and that might require you to make manual adjustments in order to port your project over to Mercury.
Conditional Compilation
Mercury, like all of Elements uses a stricter but more powerful processor for conditional compilation with #If Then
. In some rare cases, you might need to re-arrange your #If Then
, #Else
and #End If
directives so that they do not intersect with language code structures.
Read the Conditional Compilation (Mercury) topic for more details.
You might also want to check out the shared Conditional Compilation topic for all languages, the list of Standard Conditional Defines provided by the Compiler and the defined()
, exists()
and and static()
System Functions.
The My
Class
Visual Basic.NET creates an implicit My
class (and related classes) with helper APIs for common application programming tasks. Mercury provides the same classes, but they ar injected into the build in slightly different ways and it uses slightly diferent mechanics to determine what type of classes to create.
Read the The My
* Classes topic for more details.
XML Literals
XML Literals are supported and fully compatible with XElement
/Linq to XML, on the .NET platform. On all platforms, XML Literals can be used with XmlElement classes from [Elements RTL](/API/Elements RTL).
On the .NET Platform, a Project Setting is provided to determine the standard type of XML Literals to be used, when it cannot be inferred from context. The default is Elements RTL
, but projects Converted from a .vbproj
will have the setting set to use Linq to XML
.
Read the XML Literals topic for more details.