Possible Duplicates:
Solution for overloaded operator constraint in .NET generics
Define a generic that implements the + operator
Hi,
So I have a generic class MyClass<T>
and I want to put a constraint that the type T
must define an operator, for example public static T operator +(T x,T y)
.
Is that possible?
If not, I was thinking about implementing a runtime constraint using reflection. Is it possible to check if a class defines an operator like the one above using reflection? How?
Thanks, Malki.