What is the Difference between directcast and ctype?

Answer Posted / narayan sahu(netx)

The difference between the two keywords is that CType
succeeds as long as there is a valid conversion defined
between the expression and the type, whereas DirectCast
requires the run-time type of an object variable to be the
same as the specified type. If the specified type and the
run-time type of the expression are the same, however, the
run-time performance of DirectCast is better than that of
CType. DirectCast throws an InvalidCastException error if
the argument types do not match.

Is This Answer Correct ?    12 Yes 3 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

How to instantiate a delegate?

1638


What is the concept of inheritance in .net?

593


Explain how viewstate is being formed and how it's stored on client in .net?

537


Explain what is the difference between a class and an object, and how do these terms relate to each other?

532


Tell me about secure socket layer? How to make use of the technology?

543






i m fresher,hav SQL knowledge but in my ofc. i hav to work on dotnet. so plz tell me how to learn it,? from where to stat? i hav C prog. knowledge, ASP.net

2130


How big is the datatype int in .net?

563


Please explain what are an inheritance, polymorphism, and encapsulation?

568


Explain webfarm vs webgardens in .net?

580


Why do we use the “using” statement?

526


Explain what do the terms “boxing” and “unboxing” mean?

568


Explain the different parts of an assembly?

577


Define satelite assembly?

560


Tell us what is json data, and what is one way that .net developers can work with json?

560


What is the difference between asp.net and asp?

589