Cast and throw exception if failed
I need to cast an o开发者_开发问答bject as another and throw an exception if it fails, to check the type of the object.
What kind of an exception should I be looking to catch? That is, if casting fails, what exception does it throw?
InvalidCastException
精彩评论