Golgappa.net | Golgappa.org | BagIndia.net | BodyIndia.Com | CabIndia.net | CarsBikes.net | CarsBikes.org | CashIndia.net | ConsumerIndia.net | CookingIndia.net | DataIndia.net | DealIndia.net | EmailIndia.net | FirstTablet.com | FirstTourist.com | ForsaleIndia.net | IndiaBody.Com | IndiaCab.net | IndiaCash.net | IndiaModel.net | KidForum.net | OfficeIndia.net | PaysIndia.com | RestaurantIndia.net | RestaurantsIndia.net | SaleForum.net | SellForum.net | SoldIndia.com | StarIndia.net | TomatoCab.com | TomatoCabs.com | TownIndia.com
Interested to Buy Any Domain ? << Click Here >> for more details...

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


Please Help Members By Posting Answers For Below Questions

what happens if you inherit multiple interfaces and they have conflicting method names?

896


What is uint16?

927


How to do and Apply Themes to Datagrid,Lable,Textbox,etc., in C#.NET 2005 Windows Application? (like who we will do themes in ASP.NET using .CSS and .SKIN files). Urgent!!

2131


Can interface inherit class in c#?

977


How to use the sreamReader class to read form a text file?

995


What is selector c#?

911


What does static mean in c sharp?

1064


What is the syntax for calling an overloaded constructor within a constructor?

964


What is private in c#?

882


What is the use of table aliases?

915


What's c# ?

980


What is the output of TextWriterTraceListener redirected?

1051


How does return work in c#?

973


Do unused Namespaces in c# affect run-time performance?

1041


What sort algorithm does c# use?

908