C# (Sharp) Programming Language Question:
Download Questions PDF

An example of a ctype and directcast.

Answer:

In the preceding example, the run-time type of Q is Double. CType succeeds because Double can be converted to Integer, but DirectCast fails because the run-time type of Q is not already Integer

Download C# (Sharp) Programming Language Interview Questions And Answers PDF

Previous QuestionNext Question
Difference between directcast and ctype.ctype(123.34,integer) - should it throw an error? Why or why not?