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

Suggestion to change properties on EmailMessage... #196

Open
ctolkien opened this issue Jul 21, 2017 · 0 comments
Open

Suggestion to change properties on EmailMessage... #196

ctolkien opened this issue Jul 21, 2017 · 0 comments

Comments

@ctolkien
Copy link
Contributor

Which implement IEnumerable<T> to ICollection<T> with new'd up empty collections on instantiation.

Rationale; typical current usage:

var message = new EmailMessage
{
    To = new List<EmailMessage> { new EmailAddress { Email = "[email protected]" } }
}

Versus new API available...

var message = new EmailMessage
{
    To.Add(new EmailAddress { Email = "[email protected]" })
}

It's shorter, more succinct and in my opinion, just nicer.

This is technically a breaking change if someone is using a collection type which implements IEnumerable<T> but not ICollection<T>. All the code I've seen both in samples and in the wild always seems to use List<T>, which does implement ICollection<T>.

This should be expanded not just the To address but to any other collection type, and probably looked at beyond EmailMessage.

Thoughts?

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

No branches or pull requests

1 participant