Dale <(E-Mail Removed)> wrote:
> I agree with Marc's initial recommendation. You should do the type checking
> that the "as" statement does and then check for null.
That depends on whether it not being a TextBox will always mean there's
a coding error. If it does, the exception generated from the failed
cast is entirely appropriate - using "as" would mask the error.
I only use "as" when the cast could legitimately fail in a non-error
case.
--
Jon Skeet - <(E-Mail Removed)>
http://www.pobox.com/~skeet Blog:
http://www.msmvps.com/jon.skeet
If replying to the group, please do not mail me too