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
Explain the ways to deploy an assembly?
Does c# support a variable number of arguments?
Define c# i/o classes?
What are the fundamental differences between value types and reference types?
What is thread pooling?
Explain the difference between access specifier and access modifier in c#?
What is a struct in C#?
What is method overriding in c#
What is command object in c#?
What do you mean by parsing and how to parse a date time string in c#?
What is dbml file in c#?
Does the system.exception class have any cool features?
What is a derived class in c#?
What is platform independence"?
How is exception handling implemented in c#?