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 by Ben Watson. Available now as an eBook at:

Leave a Reply

Your email address will not be published. Required fields are marked *

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>