开发者

Cast and throw exception if failed

开发者 https://www.devze.com 2023-02-03 01:41 出处:网络
I need to cast an o开发者_开发问答bject as another and throw an exception if it fails, to check the type of the object.

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

0

精彩评论

暂无评论...
验证码 换一张
取 消