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.
Asked
Active
Viewed 4,824 times
3 Answers
14
Not an enum, but:
var primitives = typeof(int).Assembly.GetTypes()
.Where(type => type.IsPrimitive).ToArray();

Marc Gravell
- 1,026,079
- 266
- 2,566
- 2,900
12
The nearest you are going to get is System.TypeCode.

Martin Brown
- 24,692
- 14
- 77
- 122
-
This will suffice. Thanks bunch – epitka Dec 01 '09 at 15:12