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

An example of a ctype and directcast.

C# (Sharp) Programming Language Interview Question
C# (Sharp) Programming Language Interview Question

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?