You cannot do this in the reflection code, because in the reflection code you are talking about object , and there is nāt such a thing as in the Nullable<T> box - this is either the base value in the box, or null .
If you know the actual type, you can use the constructor to create the wrapped value, but should only be assigned to the entered field / variable Nullable<T> - not object - otherwise the CLI will open it again.
However, for the same reason you do not need it ; it terminates when using reflection; any code, such as SetValue , will take an object and do what it needs to; regardless of whether it is null or the base value in the box, it will be processed correctly.
Basically, the CLI has special handling when boxing and unpacking Nullable<T> , which makes the question invalid.
source share