I'm still trying to map my deep and old knowledge from C/C++ to my somewhat more shallow .Net knowledge. Today the time has come to "as" (and implicitly "is" and cast) in C#.
My mental model of "as" is that it's a QueryInterface
or dynamic_cast
(a dynamic_cast
with pointer argument, not reference, that is) for C#. My question is two-fold:
- Is my comparison fair?
- What's the relative cost of "as" compared to
QueryInterface
ordynamic_cast
?