Click here to Skip to main content
15,947,411 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
what is directcast and in what kind of situation we use this
Posted

Below link will help you.

DirectCast vs. CType[^]
 
Share this answer
 
 
Share this answer
 
The DirectCast is used to casting objects from one datatype to another. You use it the same way you use the CType keyword.

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.

however, the run-time performance of DirectCast is better than that of CType.
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900