If I understand it correctly, Visual Studio is supposed to Color Data Types Blue. So why doesn't it do that with DateTime?
Thanks
int
is a keyword as defined in the C# Language specs, whereas DateTime
is a struct. If you use Int32
, you'll notice that that too will turn to the same colour as DateTime because Int32
is not a keyword (even though int
is an alias for Int32
).
The default colour settings in Visual Studio is to highlight keywords
blue which is why the keywords you've shown are in blue.
DateTime is not a keyword; it is a struct, which is a ValueType, whereas a class is a Reference type. These are not considered primitives, so they are not colored unless you change the color in your VS settings.
Technically the keywords int, string, bool, and double are keywords, but they map to their Struct equivalent in the .NET framework. This way an int works the same in VB and C#.
So an int maps to Int32 Struct. They are colored blue to mimic primitive types as they are in other languages.
Details
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