What’s wrong with this code? – 1 – Answer

The main thing wrong with the code is that object.ReferenceEquals(a,b) will ALWAYS return true because it’s comapring structs, which are value types. Value types are passed by value, not reference, so every instance is different.


Check out my latest book, the essential, in-depth guide to performance for all .NET developers:

Writing High-Performance.NET Code, 2nd Edition by Ben Watson. Available for pre-order: