What is the Difference between directcast and ctype?
Answers were Sorted based on User's Feedback
Answer / aravindreddy
DirectCast requires the run-time type of an object variable
to bethe same
as the specified type.The run-time performance
ofDirectCast is better
than that of CType, if the specified type and the run-time
expression are the same.
Ctype works fine if there is a valid conversion defined
expression and the type.
|Is This Answer Correct ?||16 Yes||2 No|
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|
Answer / suresh
Direct cast: Supports only reference type conversions
it throws exception
CType cast: supports only Value type conversions
|Is This Answer Correct ?||7 Yes||22 No|
Write a program to create a user control with name and surname as data members and login as method and also the code to call it.
Can you share processes between Windows services?
Is .net capable of supporting multi-thread?
What is an Interface? Have you ever developed an Interface.
Tell us what is a sealed class?
Is it possible implement webservices without SOAP?
Describe the use of following com+ services jit activation, queued components, object pooling.?
Please explain what is heap and what is stack?
I want to serialize instances of my class. Should I use xmlserializer, soapformatter or binaryformatter?
How do you create threading in .NET? What is the namespace for that?
How to produce an assembly?
What?s SingleCall activation mode used for?