On 12/02/2008, Niblett, Alex <[EMAIL PROTECTED]> wrote: > We have an old guidelines note to use IsAssignableFrom() followed by a > hard cast as opposed to using the 'as' keyword followed by a check for > null, but there is no explanation for why this approach should be used. > There are also no comments on the 'is' keyword approach to casting. Can > somebody please explain why?
The VS.NET code analyser (based upon FXCop) definitely suggests the opposite, to reduce the number of casts. Note that as only works on reference types however, and that may be where your note came from. Regards, Mark Hurd, B.Sc.(Ma.)(Hons.) =================================== This list is hosted by DevelopMentorĀ® http://www.develop.com View archives and manage your subscription(s) at http://discuss.develop.com