Possible Duplicates:
Direct casting vs 'as' operator?
Casting: (NewType) vs. Object as NewType
What is difference between normal typecasting and using “AS” keyword?
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
Using
aswill fail gracefully if the object is the wrong type, and the resulting value will be null, where a normal cast would throw an InvalidCastException: