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

Compiler Error CS1535

Overloaded unary operator 'operator' takes one parameter

The definition of a unary overloadable operator must take one parameter.

The following sample generates CS1535:

// CS1535.cs
class MyClass
{
    // uncomment the method parameter to resolve CS1535
    public static MyClass operator ++ (/*MyClass MC1*/)   // CS1535
    {
        return new MyClass();
    }

    public static int Main()
    {
        return 1;
    }
}

Community Additions

ADD
Show:
© 2015 Microsoft