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.
11,195 questions
0 comments No comments
{count} votes

Accepted answer
  1. Michael Taylor 56,091 Reputation points
    2021-03-11T15:14:04.34+00:00

    Language feature requests should be posted to the Github repo for the compiler. In general you are required to fill out a lengthy form on the proposal of how it should work, rationale, etc.

    0 comments No comments

1 additional answer

Sort by: Most helpful
  1. Viorel 118.9K 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.


Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.