which is faster convert or directcast

  • Thread starter Thread starter Brian Henry
  • Start date Start date
B

Brian Henry

Which is faster or considered the better way to do this.

I have a object that holds a date...

Convert.ToDate(object)

or Directcast(object,DateTime)

? Thanks
 
Brian,

Because it are less characters to type

CDate(Object)

One of the extras of VBNet is that it has a lot of powerfull conversion
methods.

Cor
 
DirectCast is faster, but it assumes you know the Type at runtime though.
For example,

MyEventHandler( Sender as Object , e as EventArgs )
// 'Sender' Cannot be evaluated as a type until runtime, so this assumes
this is the correct type.


Regards

--

OHM ( Terry Burns )
. . . One-Handed-Man . . .
If U Need My Email ,Ask Me

Time flies when you don't know what you're doing
 
Hi Terry,

Where did you been, I thought he has taken hollidays.

I even answered an hour ago a question about "proper case" which I always
leave for you.

One of the message from you I saw in this newsgroup where you had a
(friendly) discussion about that with Herfried. Was something about Correct
case I thought.

:-)

Cor
 
Sorry, it was just another method !


--

OHM ( Terry Burns )
. . . One-Handed-Man . . .
If U Need My Email ,Ask Me

Time flies when you don't know what you're doing
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top