Difference between direct type casting and using "as" keyword?
Answer Posted / amitabh dubey
Explicit cast throws an InvalidCastException if the object
can not be casted. you have to
Keep the casting under try / catch block to handle the
exception.
Instead you can use as operator which return null if it
can not cast the object.
Is This Answer Correct ? | 25 Yes | 0 No |
Post New Answer View All Answers
What does readonly mean in c#?
What are actions in c#?
Why do we use readonly in c#?
Difference between value and reference type. What are value types and reference types?
Describe two uses of the “using” statement during the operation of c#?
Define a class and an object?
Define strong name in c#?
What is platform independence"?
Why do we need generics?
Hi Friends, I am going through Siemens Interview Procedure from last 1+1/2 months. I went through 1 written + 2 Technical + 1 Managerial Round process after which I got call from HR informing that "you are selected and we would like to meet you for HR round". HR round was very nominal compared to MR. HR Round last for hardly 5 mins. They told me that you will get the final result on Friday. Still I have not received any feedback from them. Please help!!!
Which programming language is best for desktop applications?
What is the difference between abstract and abstraction?
Explain the steps to create satellite assembly?
what is a constructor? What is a destructor?
Can struct inherit from class c#?