This question already has an answer here:
- Nullable create via reflection with HasValue = false, given a parameter of type `Type` only 2 answers
Given a type parameter which is a Nullable<>
, how can I create an instance of that type which has HasValue
= false?
In other words, complete this code:
public static Nullable<T> Create<T>() where T : struct
{
//Instantatie a Nullable<T> with reflection whose HasValue = false, and return it
}
Aucun commentaire:
Enregistrer un commentaire