We all know the 15 common value types that exists in C#:
sbyte, short, int, long, byte, ushort, uint, ulong, char, float, double, decimal, bool, enum, struct
If you count nullable counterpart separately, it makes them 30.
I remember one of the MS certification books mentioning that “there are over 400 builtin value types in CLR”, although I cannot find any references to it online, nor have I found anyone else mentioning it.
So I’m curious to know – is that all? If not, how do you find the rest and have you used them in any project?
I suspect it means “in the .NET framework” rather than “in the CLR”. (C# defines relatively few. Note that
enumandstructthemselves aren’t types. The CLR itself knows of even fewer – it doesn’t have any special support fordecimalfor example.)Your list doesn’t include things like
DateTime,TimeSpan,Guid,List<T>.Enumeratoretc. Basically you could load a bunch of assemblies with reflection to find more. I suspect the certification guide really meant the set of value types in the framework.