Performance of: if (OBJECT_INSTANCE is TYPE)

Posted by Axonn on Stack Overflow See other posts from Stack Overflow or by Axonn
Published on 2011-02-03T23:15:56Z Indexed on 2011/02/03 23:26 UTC
Read the original article Hit count: 211

Filed under:
|

I am working both in C# and ActionScript 3. Both language are type-aware, so you can do verifications such as:

if (some_object_instance is SomeClassName_ThatIs_SomeType)

I'm doing these kind of verifications in a few places. Might be a dumb question, but I will ask it anyway, and I want answers from both camps, C# and ActionScript:

What goes on behind the scenes? Is it Reflection? If is, isn't this a long verification which might degrade performance if done in thousands of loops? And by "degrade performance" I mean, is it more intensive than say if (Math.sqrt(8) > Math.sin(10))

© Stack Overflow or respective owner

Related posts about c#

Related posts about actionscript-3