What is special about .NET primitive types?

157 views Asked by At

I was reading about primitive types on msdn, but then I came across this answer on a StackOverflow question about primitive types. The two seem to differ ever so slightly.

According to the msdn documentation, it states a few of the advantages of primitive types:

  • Primitive types permit literal values.
  • Primitive types can be declared as constant values.
  • Operands of an expression made up of all primitive types can be compiled into a constant expression.

However, the part that differs is that the StackOverflow states that System.String, for example, is not a primitive type. This makes sense: typeof(System.String).IsPrimitive yields false. And, the StackOverflow answer points to the CLI Spec: ECMA 335 (link is broken) as its source of reference. This leads me to believe that the msdn documentation is not entirely accurate. If that is the case, then what makes primitive types so special?

1

There are 1 answers

1
Panagiotis Kanavos On

The MSDN link points to an ancient page about Visual Basic.NET 2003. In the current specification String was removed from the list of primitive types. The Visual Basic Language Reference doesn't mention String as a primitive type, even for VB.NET 2003.

I suspect this was a documentation error back in 2003