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 does out mean in c#?

870


Can I define a type that is an alias of another type (like typedef in c++)?

941


What is the difference between function and method in c#?

849


What does it mean?

886


Explain how do you convert a value-type to a reference-type?

811


Which language is used for desktop application?

893


What is singleordefault?

850


What are the basics of c#?

972


What is the full form of GAC? Explain its uses?

938


What is datatable in c#?

880


Why delegates are type safe?

861


What are floating point numbers?

914


What is sqlconnection in c#?

867


Why is c# a good programming language?

917


Why do we use overloading in c#?

927