Steven,
Thanks for your input. In the example you provide of Math.Floor() I sort of
assumed that Floor is a static method so it makes sense that you would call
it without instantiating an object. What good is it to fire the constructor
in a class if you don't assigne the object reference to a variable? The
object is lost and now just wasted memory. It bakes my noodle is that the C#
compiler would even allow me to instantiate an object without assigning it to
a variable. The sample code I provided uses it as an artifical test just to
make sure that the class would instantiate without throwing an error. I
wouldn't expect to ever leave that sort of code in a release application and
I can't figure out what sort of practical use such a statement could have in
a live application.
"Steven Nagy" wrote:
It would mean that any code in the NullTokenVisitor's constructor will
be called. Perhaps the code in that constructor has some affect on
objects outside of its scope. Maybe it "adds 1" to the "Visitor" table
in a database or something. God knows really... whats in the
constructor code?
Its kind of along the same lines as something like this:
Dim d as double = 45.7214
Math.Floor(d)
I can call Math.Floor(d) and not assign its result to anything. It
would be pointless, but the compiler accepts it, and still performs the
flooring function....
This help?
I could be wrong tho... (I usually rate my chances at around 25%
correctness)