c# swap operator

josh BAUER 166 Reputation points
2021-03-11T12:19:07.6+00:00
class ww
{
    static public bool operator <==>(ww firstParam,ww secondParam ){
        return false;
    }
}

I do like above swaping operator. In c++ it would work fine because swaping operators
were introduced in c++ version15.

By swaping I mean to exchange two values.

How to do <=> operator in c#?

If it is not yet possible, would Microsoft make it possible same like they did it for c++?

C#
C#
An object-oriented and type-safe programming language that has its roots in the C family of languages and includes support for component-oriented programming.
10,237 questions
0 comments No comments
{count} votes

1 additional answer

Sort by: Most helpful
  1. Viorel 112.1K Reputation points
    2021-03-11T13:15:54.047+00:00

    Could you show a reference (documentation) for swapping operators in C++?

    There is also a new “<=>” operator in C++, but it does not perform swapping. The equivalent in C# is the IComparable interface, I think.