You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I think there two issues with the implementation of the Equals function of the InternetAddressList. The most important issue is that it goes through both lists with a for loop and compares the indivudal InternetAddresses on both sides by calling .Equals on the InternetAdress objects. However the InternetAdress class does not implement its own Equals function and therefore falls back on reference comparison.
The second issue is that the implementation with a for loop implies that the lists that are being compared are in the same order. In other words, it treats two lists with the same InternetAdresses on them, but in a different order, as not equal. Although this is debatable, conceptually it would probably be better to do something like "SequenceEqual' from linq.
The text was updated successfully, but these errors were encountered:
Seems fair. I think my original purpose for IEquatable was for the unit tests, but making it such that 2 lists compare as equal even in different orders seems reasonable.
I think there two issues with the implementation of the Equals function of the InternetAddressList. The most important issue is that it goes through both lists with a for loop and compares the indivudal InternetAddresses on both sides by calling .Equals on the InternetAdress objects. However the InternetAdress class does not implement its own Equals function and therefore falls back on reference comparison.
The second issue is that the implementation with a for loop implies that the lists that are being compared are in the same order. In other words, it treats two lists with the same InternetAdresses on them, but in a different order, as not equal. Although this is debatable, conceptually it would probably be better to do something like "SequenceEqual' from linq.
The text was updated successfully, but these errors were encountered: