Primitive Types are not defined in the C# Language Specification. They are instead defined in .NET itself, and the best reference for primitive types is to look straight at Type.IsPrimitive
on MSDN. Specifically, the Remarks section lists the primitive types that are available.
So that we've got a complete reference here, these are the primitive types defined in the CLI Spec (Section I.8.2.2):
Contrary to popular belief, just because a type has a corresponding keyword does not make it a primitive type, the best example is probably string
.
Value types, on the other hand, may or may not be primitives also. There are lots of value types "built-in" to the .NET Framework in addition to those defined in the CLI Spec, but they are not classed as primitives. A good example is DateTime
, which is a struct
provided by the .NET Framework, by that definition it could be considered a "built-in value type". You can read more about value types (which will of course cover the built-in ones also) here.
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…