According to what I can find I believe DateTime
is a primitive type but when I check my DateTime
variable the property IsPrimitive
is false.
7.3 Primitive Types (archive.org mirror)
In the article above you'll see that they say DateTime
is primitive. So is there anything I'm doing wrong or have I read the article wrong?
Date
(which maps to System.DateTime
) is a primitive type of the Visual Basic .NET language (VB.NET for short).
It's not a primitive type in C#, and it's not a primitive type in the CLR either.
A primitive type for a given language is a type for which you can write a string literal, and this literal is understood by the compiler to be of the relevant type. You can't do this for DateTime in C#.
A primitive type for the CLR is a type on which some low level optimizations are allowed. It's very restricted: only string and the different integer and floating-point numbers structs are primitive types.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With