Is type casting slow (C#)
It's slower than BaseClassObject as DerivedClass, though, from what I recall, but not significantly.
It's only slower if the conversion fails, as castclass will throw an exception while isinst will simply return null.
[Edited by - Mike.Popoloski on November 9, 2008 10:53:46 PM]
[Edited by - Mike.Popoloski on November 9, 2008 10:53:46 PM]
Not so much, but the need for it is indicative of a design failure somewhere. Sometimes it's small, or saves a ton of time, or a corner case... but something that tells you to take a second look at the design. Make sure you're stepping outside the norm for a good reason.
This topic is closed to new replies.
Advertisement
Popular Topics
Advertisement