IP Addresses are just numbers. Numbers are comparable. Some are bigger, some are smaller, some are even equal.
DefaultIPAddressComparer will gladly compare
IPAddress of differing address families.
Comparer<IPAddress>. Its behavior is to first compare two
IPAddress objects via the
IComparer<AddressFamily> and then ordinally based on the
IPAddress big-endian unsigned integer value.
By default the DefaultAddressFamilyComparer is used to compare the address families of the addresses, but that may be overridden by providing your own
IComparer<AddressFamily> to the appropriate constructor
public DefaultIPAddressComparer(IComparer<AddressFamily> addressFamilyComparer)