C# cast options, is there any difference other than syntax?
This question already has an answer here:
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.
上一篇: 演员之间有什么区别:(A)x和x是A?
下一篇: C#转换选项,除语法之外是否有区别?