I\'ve read somewhere on MSDN that the equivalent to C#\'s \"is\" keyword would be dynamic_cast, but that\'s not really equivalent: It doesn\'t work with value types or with
You can use safe_cast
where you would use dynamic_cast
in native C++ and trap the System::InvalidCastException. In terms of compatible types the semantics of asking if you can convert types could pick up a broader range of types than checking identity. You may actually want the added flexibility of IsAssignableFrom.
I don't think there's an efficient equivalent to the good old dynamic_cast
idiom we're used to, certainly nothing as compact.