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
What is thread.sleep()?
What is the meaning of console writeline in c#?
Can private virtual methods be overridden in c#.net?
Does the variables of a private class-level inherited?
Distinguish between the Debug class and Trace class with its functionality?
Explain how do you debug an asp.net web application?
What are data types in C#?
Explain the features of an abstract class in net.
Can you store strings in arrays?
What is the use of ispostback in c#?
We cannot create instances of static classes. Can we have constructors for static classes?
Explain the functionalities of satellite assembly?
What do you mean by a windows process in regards to memory allocation?
What does console readkey do in c#?
What is private protected in c#?