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 |
Is string a data type in c#?
What is the data encapsulation?
Hi all,I am the beginner. Please tell use of finally block.
What?s the implicit name of the parameter that gets passed into the class? set method?
Can we extend sealed class in c#?
What is singleordefault c#?
What is difference between dynamic and var in c#?
Can an Assembly have multiple versions
What?s the advantage of using System.Text.StringBuilder over System.String?
Explain the types of Polymorphism.
What is a console application in c#?
How to use session under class file of APP_Code folder?
Visual Basic (800)
C Sharp (3816)
ASP.NET (3180)
VB.NET (461)
COM+ (79)
ADO.NET (717)
IIS (369)
MTS (11)
Crystal Reports (81)
BizTalk (89)
Dot Net (2435)
Exchange Server (362)
SharePoint (720)
WCF (340)
MS Office Microsoft (6963)
LINQ Language-Integrated Query (317)
WPF (371)
TypeScript (144)
Microsoft Related AllOther (311)