Skip to content

Incorrect statement about increment/decrement operator overloading in C# docs #46891

Open
@bilalm398

Description

@bilalm398

Type of issue

Typo

Description

On this page: https://learn.microsoft.com/en-us/dotnet/csharp/language-reference/operators/operator-overloading

The sentence:
"The increment (++) and decrement (--) operators can be implemented as either static or instance methods."

Is incorrect for C#. In C#, operator overloads (including ++ and --) must always be declared static, as enforced by the compiler.

I believe this sentence may have been copied from C++ documentation by mistake.

Please review and correct if needed.

Page URL

https://learn.microsoft.com/en-us/dotnet/csharp/language-reference/operators/operator-overloading

Content source URL

https://github.com/dotnet/docs/blob/main/docs/csharp/language-reference/operators/operator-overloading.md

Document Version Independent Id

5ec5c397-c7c6-700c-bc36-a8dfb2396dad

Platform Id

e83aae5a-e070-c00c-3914-cadfa33a9fe9

Article author

@BillWagner

Metadata

  • ID: f91d85ae-8b37-e837-a031-144571362fbb
  • PlatformId: e83aae5a-e070-c00c-3914-cadfa33a9fe9
  • Service: dotnet-csharp
  • Sub-service: lang-reference

Related Issues

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions