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 as the runtime type since it requires the run-
time type of an object variable to be same as the specified
type. In this case runtime type of 123.34 (double) doesn?t
match with integer.
Is This Answer Correct ? | 1 Yes | 1 No |
Post New Answer View All Answers
What is extension method in c# and how to use them?
Why do we need abstraction in c#?
Can we inherit partial class in c#?
How do you declare a variable in c#?
What is the implicit name and type of the parameter that gets passed into the class set method?
What is attribute and reflection in c#?
What is type checking in c#?
What is the difference between string keyword and system.string class?
What is use of console?
Is multiple inheritance possible in c#?
What is array collection?
What is different about switch statements in c#?
What is strong name in c# and how can we use it?
How does dictionary work in c#?
What are Indexers in C#?