Is there anyway to define type parameter T
as the ones that define operator overloading? Take for example, I need to create a generic Add
function with the parameter T
. Obviously, the T must defined the +
operator, i.e.,
public static T operator +(T c1,T c2)
{
// plus operation
}
Is there anyway to constraint T
so that it is restricted to the types that overload the operators?