Search⌘ K
AI Features

Implementing Interfaces: Comparing Objects Using a Separate Class

Explore how to implement the IComparer interface in a separate class to compare and sort C# objects when you cannot modify their source code. Understand sorting techniques by name length and alphabetical order for custom object collections.

Comparing objects using a separate class

Sometimes, we won’t have access to the source code for a type, and it might not implement the IComparable interface. Luckily, there ...