C# cast options, is there any difference other than syntax?

This question already has an answer here:

  • Direct casting vs 'as' operator? 15 answers

  • The first one will throw InvalidCastException if the types don't match (refer to the documentation - "Explicit conversions" section). The second one (the as operator) will produce null value instead.

    链接地址: http://www.djcxy.com/p/73740.html

    上一篇: 演员之间有什么区别:(A)x和x是A?

    下一篇: C#转换选项,除语法之外是否有区别?