C# Equality and Comparisons

by Simon Robinson

This course teaches you how equality and comparisons function in .NET and the correct way to implement equality and comparisons for your own types.

What you'll learn

In this course, you'll learn how to use equality and comparisons correctly in your C# code: both how they work out of the box, and how to implement equality and comparisons for your own types. The course also covers working with inheritance, string comparisons, writing custom comparers and equality comparers, hash codes, and structural comparisons.

Table of contents

About the author

Simon is a senior developer with over 20 years programming experience, particularly covering C++ and the .NET Framework. He believes knowledge is to be shared and has written or co-written more than a dozen books for professional programmers.

Ready to upskill? Get started