Or you could - I dunno - cache the result of the dynamic cast in a local, since doing multiple dynamic casts is terrible style anyway. Just saying. ;)
Yes, this is true of many optimizations :PAre you saying it's bad style because of the expense of dynamic casting or for some other reason? If dynamic cast were pure, that takes away that argument.
-Steve