I want to create a universal class that takes a type parameter and restricts this parameter to numeric types or, more generally, to any type on which the increment operator ++ can be applied.
I know that I can do the following to restrict structures, but obviously there are structures that are not numeric types and for which the ++ operator is not supported. Can i do this in c #
class Example<T> where T : struct
{
}
source
share