What's the difference between cast syntax and using the as operator?
Using the as operator differs from a cast in C# in the following ways:
It returns null when the variable you are trying to convert is not of the requested type or in it's inheritance chain, instead of throwing an exception.
It can only be applied to reference type variables converting to reference types.
No comments:
Post a Comment