Data types

S

Steve Peterson

I'm really curious on something. I just jumped to the 2005 platform and I
noticed something using the code snipplets. I have up to now been declaring
my variables and properties with Int64, Int32, Int16. However, I notice that
the code snipplets do it as Double, Integer, and Short. What the heck is the
difference? Is one way the better ".NET" way than the other? Also which is
better to use: Date or DateTime?

TIA
Steve
 
C

Cor Ligthert [MVP]

Steve,

I wished there was a difference, but they stopped with it. An Integer at the
moment the same as an Int32. If they had not don that, than the integer
could have been on a 64 bits computer a Int64 and been processed something
quicker on a 64bit system, without code change.

Int32 could than be used to describe a real Int32, by instance to be used in
an API and Integer as the most efficient (processing) value.

I use it however in that way. An Int32 in my programmes describes a real
Int32 and an Integer the most optimal to use value.

An int64 is a Long (Integer) while Short (Integer) is a 16Bit Value.

A Double is a 8 bytes double precision floating point value.

A date and datetime are the same, it holds forever a datetime value.
I use forever DateTime from which the date part is datetime.date

I hope this gives an idea.

Cor
 
H

Herfried K. Wagner [MVP]

Steve Peterson said:
I'm really curious on something. I just jumped to the 2005 platform and I
noticed something using the code snipplets. I have up to now been
declaring my variables and properties with Int64, Int32, Int16. However, I
notice that the code snipplets do it as Double, Integer, and Short. What
the heck is the difference? Is one way the better ".NET" way than the
other? Also which is better to use: Date or DateTime?


'Byte', 'Short', 'Integer', etc. are just aliases for 'UInt8', 'Int16',
'Int32', etc. I suggest to use 'Integer', etc. because they seem more
natural in VB.NET. 'Date' is simply an alias for 'DateTime'. Note that the
type aliases are colored differently from the other types in the VS.NET
IDE's text editor.
 

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

Top