Armin said:
... It was a spontaneous thought, and as I didn't find such an attribute,
maybe useful for other purposes as well (or better), I asked here.
Armin, you are probably aware of the <Conditional(CONST or DEFINE)>
attribute but I found this interesting.
<Conditional("TEST")> _
Private Sub Test()
...
End Sub
The main purpose is to satisfy the compiler but it will never called
the function come run time.
This is useful to place test() in various spots throughout your code:
...
...
Test()
...
...
Test()
and the compiler will only link in the test() method if the TEST
constant is defined. This is great because it saves one from doing
(like me <g>)
...
...
#if TEST then
Test()
#end if
...
...
#if TEST then
Test()
#end if
In C/C++ this can done with a #define macro translation
#ifdef TEST
# define Test()
#endif
which the compiler will replace all occurrences of Test() calls with
nothing thus nullifying the statement.
What would be useful if the condition allows a GetType to see if a
class exist.
Anyway, thought I would share this for anyone who didn't know about it.
--