Assumption - C # Equality Members - Example. Equality Method (...). C # Equality Comparer - e.g. IEqualityComparer interface.
In the short answer, with Equality Compare you can increase the usability of your code.
For example, you are building a vehicle catalog, and you want to make sure that the key, which is the model number and code, is not the same. Now this logic is for any vehicles. Thus, it is a good idea to define a default comparison and use it everywhere.
Here is an example of your help:
using System; using System.Collections.Generic; using ConsoleApplication3; public class Program { internal class Car : IVehicle { public List<string> Features { get; set; } public string ModelNumber { get; set; } public string ModelCode { get; set; } } internal class Bike : IVehicle { public string ModelNumber { get; set; } public List<string> Features { get; set; } public string ModelCode { get; set; } } public static void Main() { var carCatelogue = new Dictionary<Car, int>(new GlobalEqualityComparer()); var bikeCatelogue = new Dictionary<Bike, int>(new GlobalEqualityComparer()); carCatelogue.Add(new Car() { ModelCode = "100", ModelNumber = "CAR-01", Features = new List<string> { "BEST ENGINE", "5 GEAR", "SPOTY" } }, 5); carCatelogue.Add(new Car() { ModelCode = "100", ModelNumber = "CAR-02", Features = new List<string> { "SUPER FAST ENGINE", "4 GEAR", "SPOTY RED" } }, 10);
In the case of using members like equals, you have to write the same logic for Car as well as for Bike.
Now that you would like to use where it will be, it will be completely reduced to you.
If you are happy with the Equal ie base, compare the link to the link or value to the value, then you can stay with it and you do not need to redefine it.
If you are specific to any issue, you need to give an example.
Hope this helps.