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...

directcast(123.34,integer) - should it throw an error? Why
or why not?

Answer Posted / debasis sengupta

directcast(123.34,integer) would throw an InvalidCast
exception since it requires the runtime type of the object
variable to be same as the specified type. In this case
runtime type of 123.34 (double) doesn?t match with integer.

but for ctype(123.34,integer) - it would work fine. As the
runtime type of 123.34 would be double, and Double can be
converted to Integer.

Is This Answer Correct ?    6 Yes 0 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

What is difference between static and constant variable?

990


List down the reason behind the usage of c# language.

1312


What is the difference between a variable and a literal?

1060


What is the difference between interface and abstract class in c#?

916


What is a clr host?

961


Why do we use static methods in c#?

1011


Can we extend sealed class in c#?

913


What do you know about Translate Accelerator?

1087


What are the properties of string?

962


What is ienumerator c#?

878


Why do we need generics in c#?

931


Explain About friend and Protected friend

903


What is scope c#?

877


How do I link two windows forms in c#?

933


What is the reason behind the invention of c#?

1126