C# Generic Operators
问题 I am trying to implement a generic operator like so: class Foo { public static T operator +<T>(T a, T b) { // Do something with a and b that makes sense for operator + here } } Really what I'm trying to do is gracefully handle inheritance. With a standard operator + in Foo, where T is instead "Foo", if anyone is derived from Foo (say Bar inherits Foo), then a Bar + Bar operation will still return a Foo. I was hoping to solve this with a generic operator +, but I just get a syntax error for