Mark Wilden <(E-Mail Removed)> wrote:
> > > B oB = oA as B;
> > > if (oB != null)
> > > {
> > > <do something with oB>
> > > }
>
> I would prefer
>
> ((B oA).<do something>
>
> as it will throw a meaningful exception if oA is not a B, instead of
> doing nothing.
Yes - so would I, very definitely, *if* it really should be that type.
(That's actually the more common case at the moment, I find - generics
may well change that though.)
--
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