VB .NET Reverse Engineering Preprocessing

VB .NET files may contain conditional code that needs to be handled by preprocessing directives during reverse engineering. A preprocessing directive is a command placed within the source code that directs the compiler to do a certain thing before the rest of the source code is parsed and compiled. The preprocessing directive has the following structure:

#directive symbol

Where # is followed by the name of the directive, and symbol is a conditional compiler constant used to select particular sections of code and exclude other sections.

In VB .NET symbols have values.

In the following example, the #if directive is used with symbols FrenchVersion and GermanVersion to output French or German language versions of the same application from the same source code:

  #if FrenchVersion Then
   '  <code specific to French language version>.
  #ElseIf GermanVersion Then
    ' <code specific to French language version>.
  #Else
    ' <code specific to other language version>.
  #End If

You can declare a list of symbols for preprocessing directives. These symbols are parsed by preprocessing directives: if the directive condition is true the statement is kept, otherwise the statement is removed.


Created October 7, 2009. Send feedback on this help topic to Sybase Technical Publications: pubs@sybase.com