The pattern using the "as" keyword is for performance only. If you want to make a trade-off between performance and maintainability/readabilty you can use the "is" keyword method instead.
If I remember correctly, two casts is slower than a single cast and a test for null (hence the CA/FxCop recommendation to use "as" once then compare the object to null). -- Peter Microsoft MVP, Visual Developer - Visual C# http://www.peterRitchie.com/Blog/ On Mon, 17 Jul 2006 11:42:45 -0400, Kristofer Krebs <[EMAIL PROTECTED]> wrote: >My problem is when you have a lot of subclasses to Node that you want to >process in different ways the second example gets very deeply nested and >hard to maintain. Is there a better way to deal with multiple downcasts >like this? =================================== This list is hosted by DevelopMentorĀ® http://www.develop.com View archives and manage your subscription(s) at http://discuss.develop.com
