paint-brush
C# Sorting - A Minor Errorby@davidebellone

C# Sorting - A Minor Error

by Davide Bellone | Code4IT2mApril 22nd, 2021
Read on Terminal Reader
Read this story w/o Javascript
tldt arrow

Too Long; Didn't Read

It isn't true that the inverse of a negative number is a positive number. The inverse of -2,147,483,648 would cause overflow and returns the same value. The best solution is to simply switch the parameters: CompareTo(y, x). The result is a terrible idea to use CompareTo(-x, -y). Results can be unexpected. The lesson is that we must know the basics of a language not only in terms of syntax but also the inner handling of inner handling.
featured image - C# Sorting - A Minor Error
Davide Bellone | Code4IT HackerNoon profile picture
Davide Bellone | Code4IT

Davide Bellone | Code4IT

@davidebellone

I write about .NET development and general coding stuff. - developer - blogger - speaker -

Learn More
LEARN MORE ABOUT @DAVIDEBELLONE'S
EXPERTISE AND PLACE ON THE INTERNET.
L O A D I N G
. . . comments & more!

About Author

Davide Bellone | Code4IT HackerNoon profile picture
Davide Bellone | Code4IT@davidebellone
I write about .NET development and general coding stuff. - developer - blogger - speaker -

TOPICS

THIS ARTICLE WAS FEATURED IN...

Permanent on Arweave
Read on Terminal Reader
Read this story in a terminal
 Terminal
Read this story w/o Javascript
Read this story w/o Javascript
 Lite
Also published here
Allella
Coffee-web
Learnrepo
Trom