Binary Search & Bitwise Complement
Did you know that Array.BinarySearch() would return the closest result if it couldn't find an exact match, but bit flipped?
I just read this post, and I had a WTF moment. How the hell are you supposed to discover such a thing? It's certainly useful, and I would probably have loved to have used it once or twice. But this has zero discoverability.
Makes me wonder what other nuggets there are out there.
Comments
Comment preview