primitive types enum - does it exist
-
22-07-2019 - |
Question
I need to provide a user a list of all primitive types available and was wondering if there is an Enum in the .net library that has all primitive types, so that I don't have to build one.
Solution
The nearest you are going to get is System.TypeCode.
OTHER TIPS
Not an enum, but:
var primitives = typeof(int).Assembly.GetTypes()
.Where(type => type.IsPrimitive).ToArray();
No, there is no such enum.
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow