Why is the use of pointers in generic types invalid in C #? int?*invalid, while typeof(int?).MakePointerType()not throwing an exception.
According to MSDN, a pointer may contain:
sbyte, byte, short, ushort, int, uint, long, ulong, char, float, double, decimal or bool.
Any type of listing.
Any type of pointer.
Any custom structure type that contains only fields of unmanaged types.
I do not see any restrictions regarding generics. int?looks valid since it contains only the booland field int.
source
share