dotnet / dotnet/dotnet-api-docs

Definition of primitive type

Open
#920 4 comments 0 reactions 0 assignees View on GitHub
area-System.Runtime dotnet-api/prod Pri2 untriaged
Dominant language
C#
Stars
949
Forks
1.7k
Avg merge
3d 27m
Merged PRs (30d)
49

Description

This page covers the `IsPrimitive` property for types, but I haven't been able to find a definition anywhere of what a primitive type is. As far as I can tell primitive types are the value types built into .Net. Structs and Enums aren't primitive types (but are value types) as they can be user defined.

There was this [discussion](https://stackoverflow.com/questions/2066035/in-c-sharp-are-the-terms-primitive-and-literal-interchangeable/2135136#2135136), that says that 'primitive' isn't defined in the specification, but there must be a reason why the types listed on this page are deemed primitive.

This [site](https://medium.com/omarelgabrys-blog/primitive-data-types-in-c-vs-java-5b8a597eef05) describes primitives as the main built-in types, but `string`, `object`, aren't primitive as per the list on the `IsPrimitive` page, but maybe this definition isn't specific to value types.

Is there a definition, and can it be added to this page, and maybe else where in the msdn documentation?

Here's some more links:
[This page](https://docs.microsoft.com/en-us/dotnet/csharp/language-reference/keywords/built-in-types-table) mentions simple types, which seems to be the same as primitive types, but there is once again no definition of what a simple type is other than the list of types.
Here's another [page](https://docs.microsoft.com/en-us/previous-versions/visualstudio/visual-studio-2008/ms228360(v=vs.90)) that talks about primitive types with respect to both C# and Java.

---
#### Document Details

⚠ *Do not edit this section. It is required for docs.microsoft.com ➟ GitHub issue linking.*

* ID: dffb41b0-35d3-6ddc-7bfe-c162d1e32d45
* Version Independent ID: 51569306-3108-5d27-466e-44aa6acb3514
* Content: [Type.IsPrimitive Property (System)](https://docs.microsoft.com/en-us/dotnet/api/system.type.isprimitive?view=netframework-4.7.2)
* Content Source: [xml/System/Type.xml](https://github.com/dotnet/dotnet-api-docs/blob/master/xml/System/Type.xml)
* Product: **dotnet-api**
* GitHub Login: @dotnet-bot
* Microsoft Alias: **dotnetcontent**

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.