Date object vs. DateTime object
I am currently looking at the msdn pages for the date and datetime object. I also have reflector opened up, and 开发者_开发百科it looks like the date and datetime object just reference the Date structure. Why do we have two objects which reference the same structure? what is the differences between them?
The CLR classes (e.g. DateTime
, Int32
, etc.) contain the actual implementation. This is what you will see in Reflector.
Due to their heritage, C# and VB define certain aliases for commonly used data types. For example, int
in C# is an alias of Int32
. In VB, one such alias is Date
for DateTime
.
Here are lists of these aliases:
- Built-In Types Table (C# Reference)
- Data Type Summary (Visual Basic)
There is no Date
type. There is only a DateTime
type which is what you should use for any date or datetime data.
精彩评论