Difference between direct type casting and using "as" keyword?
Answer / 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 |
How do you create user defined data types in c#?
Do while loops yes or no c#?
localization using windows c#
Why do I get a "cs5001: does not have an entry point defined" error when compiling?
What’s a strong name?
Why do we need constructors?
What are mutable and immutable types in c#?
What are methods in C#?
What?s the C# equivalent of C++ catch (?), which was a catch-all statement for any possible exception?
What is different between Boxing and Unboxing?
How do you remove the objects which are not in use?Explicitly or implicitly?What is the exact mechanism going behind?
2 Answers Advanced Software Systems, Choice Solutions,
What is Implementation inheritance