Pram,
I believe DateTime is a structure, as it meets all the criteria to use when
deciding to make a type a Structure as set forth by the .NET Design
Guidelines for Class Library Developers, in that it:
- Acts like a primitive type
- It has an instance size of under 16 bytes
- It is immutable
- It has value semantics.
Which is 4 for 4!
http://msdn.microsoft.com/library/de...guidelines.asp
The one item that is not listed, but is implied by the above list is as a
Structure it is significantly easier to work with as opposed to being a
class!
Hope this helps
Jay
"Pram" <pr**@nospam.com> wrote in message
news:uw**************@TK2MSFTNGP09.phx.gbl...
I am curious why did Microsoft write System.DateTime as a structure
instead of a class?
Maybe for backward compatibilty with any existing old code?
FYI, one of the differences between structure and class is we can set the
structure to Nothing.