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 |
Can we have multiple constructors in a class c#?
why do we use Overloading, Overriding, Boxing, Unboxing, and what is the use of these ?
Which .gang of four. Design pattern is shown below?
How many types of variables are there in c#?
How do you serialize in c#?
Why do we need private constructor in c#?
What is stringwriter c#?
What is event delegate in c#?
Why do we need delegates?
What does private void mean in c#?
may we achieve polyphormsm through overloading a funtion?Is it right or wrong concept because i read polyphormism can be achieved through overloading?plz help me thnks
What is called method in c#?