How to create a generic constraint, that only allows some predefined basic data types. Something like this:
So, is this even possible?Code:T SomeFunction<T>() where T : int, double, string, Guid { // ... return (T)someValue; // someValue can be of type: int, double, string or Guid }




Reply With Quote