-
Notifications
You must be signed in to change notification settings - Fork 585
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
Impement IEquatable on EmailAddress to Filter Duplicates #425
Comments
Good suggestion. But then the comparisons should really be case insensitive. So instead of
It should be:
And instead of: It should be: The code assume that the Email property is always non-null. Perhaps that is not always the case, so null checks will need to be inserted in a few places? |
I agree with the case insensitive comparisons and with the non-null check(s). I overlooked the Email property having a public setter so the Equals(EmailAddress other) and GetHashCode would want to check for null. A null/empty check could also be added to the constructor when the email and name are passed in:
|
Issue Summary
By implementing IEquatable on EmailAddress you'd be able to filter out duplicate emails when calling methods such as AddTo(s), AddCC(s), and AddBCC(s).
IEquatable Implementation
Sample: SendGridMessage.AddTo() Taking Advantage of the IEquatable
Technical details:
The text was updated successfully, but these errors were encountered: