Primitives in .NET
David | March 4, 2015Yesterday, I was looking for a way to get a list of all the primitive types in .NET during runtime.
Microsoft .NET’s definition of primitives is here:
https://msdn.microsoft.com/en-us/library/system.type.isprimitive%28v=vs.110%29.aspx
I found a Stack Overflow thread that provides an automated way to get a full list of primitive types from the Assembly during runtime.
List
.Where(t => t.IsPrimitive).ToList();
After testing, this works fine for my purposes.