I have the following method with generic type:
T GetValue<T>();
I would like to limit T to primitive types such as int, string, float but not class type. I know I can define generic for class type like this:
C GetObject<C>() where C: class;
I am not sure if it is possible for primitive types and how if so.
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…