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 is an xsd file?

906


what are nullable types in c#

1015


What is lazy in c#?

918


What do you mean by streamreader/streamwriter class in c#?

939


What is the and operator in c#?

955


Which is faster abstract class or interface in c#?

963


What is regex c#?

886


What is iqueryable in linq?

862


why delegate is type safe?

2988


What are the types of operator?

842


What is linq c#?

872


Which is the best language for desktop application?

934


What is entity framework c#?

852


What is a nullreferenceexception and how do I fix it?

1000


What is threading in c# with example?

900