Information
The topic you requested is included in another documentation set. For convenience, it's displayed below. Choose Switch to see the topic in its original location.

Compiler Error C2826

 

'operator' must be declared static

Methods must be declared as static if they implement a managed operator.

C2826 is only reachable using /clr:oldSyntax.

The following sample generates C2826:

// C2826.cpp
// compile with: /clr:oldSyntax /c
#using<mscorlib.dll>
using namespace System;

__value struct M {
   M op_Addition(M m1, M m2) {   // C2826
   // try the following line instead
   // static M op_Addition(M m1, M m2) {
      return m1;
   }
};
Show: