开发者

Date object vs. DateTime object

开发者 https://www.devze.com 2023-02-26 18:23 出处:网络
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 struct

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.

0

精彩评论

暂无评论...
验证码 换一张
取 消