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 indexer c#?

928


What is exe file in c#?

928


What is scope c#?

921


What is list collection in c#?

1008


What is yield in c#?

914


If casting fails what type of exception is thrown?

935


Between windows authentication and sql server authentication, which one is trusted and which one is untrusted?

1022


Can you access a hidden base class method in the derived class?

953


Explain the OOPS concept in C#?

1015


Explain the access modifiers in c#?

988


What are access modifiers used for?

1138


What is difference between ienumerable and list in c#?

926


What is null character in string?

1121


Differentiate between sqlclient oledb and providers?

1003


Explain about CTS?

999