I wish to make an attribute conditional based on compilation mode.
For example this is MyFunction() which is decorated with the attribute MyAttribute():
<MyAttribute()>
Private Function MyFunction() As Boolean
....
End Function
However I only want the attribute to be applied when DEBUG is true, which sounds like a great place to use compiler directives:
#If Debug Then
<MyAttribute()>
#End If
Private Function MyFunction() As Boolean
....
End Function
However this seems to require a continuation character ( _) which in turn affects the #End If (unexpected token).
How would I achieve what I want?
Worst case, you’d could do:
This is probably due to the line continuation processing occurring before the pre-processing. For example, this is valid:
In your case, you are expecting the line continuation to occur after pre-processing.