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 thread.sleep()?

897


What is the meaning of console writeline in c#?

866


Can private virtual methods be overridden in c#.net?

897


Does the variables of a private class-level inherited?

1014


Distinguish between the Debug class and Trace class with its functionality?

1004


Explain how do you debug an asp.net web application?

911


What are data types in C#?

984


Explain the features of an abstract class in net.

964


Can you store strings in arrays?

974


What is the use of ispostback in c#?

882


We cannot create instances of static classes. Can we have constructors for static classes?

1004


Explain the functionalities of satellite assembly?

953


What do you mean by a windows process in regards to memory allocation?

958


What does console readkey do in c#?

925


What is private protected in c#?

891