Was this page helpful?
Your feedback about this content is important. Let us know what you think.
Additional feedback?
1500 characters remaining
Export (0) Print
Expand All
Expand Minimize
Important This document may not represent best practices for current development, links to downloads and other resources may no longer be valid. Current recommended version can be found here.

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 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;

Community Additions

© 2015 Microsoft