Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Problems with InternetAddresList.Equals() #118

Closed
guywyers opened this issue Mar 24, 2015 · 2 comments
Closed

Problems with InternetAddresList.Equals() #118

guywyers opened this issue Mar 24, 2015 · 2 comments
Labels
enhancement New feature or request

Comments

@guywyers
Copy link

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.

@jstedfast
Copy link
Owner

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.

jstedfast added a commit that referenced this issue Mar 24, 2015
…same addresses even in different orders

Fixes issue #118
@jstedfast jstedfast added the enhancement New feature or request label Mar 24, 2015
@jstedfast
Copy link
Owner

I'll probably be making a new release this weekend.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

2 participants