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

Port FxCop rule CA1010: CollectionsShouldImplementGenericInterface #374

Open
ghost opened this issue Nov 21, 2015 · 3 comments
Open

Port FxCop rule CA1010: CollectionsShouldImplementGenericInterface #374

ghost opened this issue Nov 21, 2015 · 3 comments

Comments

@ghost
Copy link

ghost commented Nov 21, 2015

Title: Collections should implement generic interface

Description:

To broaden the usability of a collection, implement one of the generic collection interfaces. Then the collection can be used to populate generic collection types.

Dependency: None

Notes:

@jinujoseph
Copy link
Contributor

Analyzer is complete , pending fixer

@jamesqo
Copy link
Contributor

jamesqo commented Jan 22, 2018

I'll implement the fixer. @mavasani Could you tag me?

@jamesqo
Copy link
Contributor

jamesqo commented Jan 22, 2018

Some thoughts I had while writing the fixer:

  • Should we offer to implement IReadOnlyList<T> / IReadOnlyCollection<T> in addition to generic IList/ICollection?
  • I don't think there's a good way to tell what the generic type should be. Should we put the user in a rename session for the type argument?
public class Collection : ICollection, ICollection<[|object|]>
{
    public void CopyTo([|object|][] array, int arrayIndex) { ... }

    // All of the other 'object' occurrences are highlighted
}
  • How do I unit test a rename session? (I'm calling it "rename session" but I forgot if that was the actual name. It's the thing where you press tab to complete an event handler and something like this happens

rn_sesh

)

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

No branches or pull requests

4 participants