Follow Our FB Page << CircleMedia.in >> for Daily Laughter. We Post Funny, Viral, Comedy Videos, Memes, Vines...


What is the Difference between directcast and ctype?

Answers were Sorted based on User's Feedback



What is the Difference between directcast and ctype?..

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
typeof the
expression are the same.
Ctype works fine if there is a valid conversion defined
between the
expression and the type.

Is This Answer Correct ?    16 Yes 2 No

What is the Difference between directcast and ctype?..

Answer / 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

What is the Difference between directcast and ctype?..

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

Post New Answer



More Dot Net General Interview Questions

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.

0 Answers  


Can you share processes between Windows services?

2 Answers  


Is .net capable of supporting multi-thread?

0 Answers  


What is an Interface? Have you ever developed an Interface.

5 Answers   Deloitte,


Tell us what is a sealed class?

0 Answers  






Is it possible implement webservices without SOAP?

2 Answers   HCL,


Describe the use of following com+ services jit activation, queued components, object pooling.?

0 Answers  


Please explain what is heap and what is stack?

0 Answers  


I want to serialize instances of my class. Should I use xmlserializer, soapformatter or binaryformatter?

0 Answers  


How do you create threading in .NET? What is the namespace for that?

2 Answers  


How to produce an assembly?

0 Answers  


What?s SingleCall activation mode used for?

1 Answers  






Categories