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

Consider removing DirectiveCollection #1912

Closed
Tracked by #1891
jonsequitur opened this issue Nov 2, 2022 · 0 comments · Fixed by #1946
Closed
Tracked by #1891

Consider removing DirectiveCollection #1912

jonsequitur opened this issue Nov 2, 2022 · 0 comments · Fixed by #1946
Assignees
Labels
Milestone

Comments

@jonsequitur
Copy link
Contributor

jonsequitur commented Nov 2, 2022

It can likely be replaced with a dictionary, or directives can become symbols and use the same lookup mechanisms are other symbol types use.

    // From guideline prose:
    // "When implementing such a custom collection, follow the API pattern
    // established by Collection<T> and ReadOnlyCollection<T> as
    // closely as possible. That is, implement the same members explicitly,
    // name the parameters in the same way that these two collections name
    // them, and so on. In other words, make your custom collection different
    // from these two collections only when you have a very good reason to
    // do so."
    public class DirectiveCollection : IEnumerable<KeyValuePair<string,IEnumerable<string>>>, IEnumerable 
    {
        public DirectiveCollection();
        public bool Contains(string name);
        public IEnumerator<KeyValuePair<string,IEnumerable<string>>> GetEnumerator();
        public bool TryGetValues(string name, ref IReadOnlyList<string> values);
    }
@jonsequitur jonsequitur mentioned this issue Nov 2, 2022
56 tasks
@jonsequitur jonsequitur changed the title Consider removing this type. It can likely be replaced with a dictionary, or directives can become symbols. Consider removing DirectiveCollection Nov 2, 2022
@adamsitnik adamsitnik self-assigned this Nov 3, 2022
adamsitnik added a commit to adamsitnik/command-line-api that referenced this issue Nov 3, 2022
@jonsequitur jonsequitur added this to the 2.0 GA milestone Nov 9, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants