I am new to programming in Silverlight. Can anyone tell me the difference between
FrameworkElement obj=sender as FrameworkElement
and
FrameworkElement obj=(FrameworkElement)someobject
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.
after this code obj will be FrameworkElement, if type of it is FrameworkElement, or null, in other cases. This code will not throw InvalidCastException.
this is explicit conversion, and this operation can throw an InvalidCastException
Casting and Type Conversions (C# Programming Guide)