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.
c# swap operator
josh BAUER
166
Reputation points
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++?
Accepted answer
1 additional answer
Sort by: Most helpful
-
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.