I want to overload the operator in the class. I want the overload method to be common. For instance:
class Subtractable { public static Subtractable operator-<T>(Subtractable a, T b) {
When I do this, I get the following message in the generic type parameter:
Syntax error, '(' expected
If I remove the generic type parameter, I get the following message in b type:
Cannot find type name or namespace 'T' (are you missing the using directive or assembly references?)
Is there any way to achieve this? If so, how? If not, why?
source share