Can anyone tell me if there is a way with generics to limit a generic type argument T
to only:
Int16
Int32
Probably the closest you can do is
static bool IntegerFunction(T value) where T: struct
Not sure if you could do the following
static bool IntegerFunction(T value) where T: struct, IComparable
, IFormattable, IConvertible, IComparable, IEquatable
For something so specific, why not just have overloads for each type, the list is so short and it would possibly have less memory footprint.