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

Proposal: add "IEqualityComparer Comparer" property to the IReadOnlyDictionary<K,V> and to ISet<T> #20504

Closed
dmitriyse opened this issue Mar 7, 2017 · 4 comments
Labels
api-needs-work API needs work before it is approved, it is NOT ready for implementation area-System.Collections
Milestone

Comments

@dmitriyse
Copy link

When we have only contract of the collection we cannot understand by what criteria keys or items are compared.

public void Test(ISet<MyObject> mySet)
{
      // I want to clone this set to get my personal copy.
      var myCopy = new HashSet(mySet, /*How to get comparer ?*/);
}

public interface ISet<T>
{
     // This new property can be introduced.
     IEqualityComparer<T> Compare { get;}
}

Improvements of BCL interfaces without loosing backward compatibility will be possible with help of
dotnet/csharplang#52

Also this proposal is mentioned here https://github.com/dotnet/corefx/issues/1973#issuecomment-283912409

@karelz
Copy link
Member

karelz commented Mar 7, 2017

@dmitriyse let's please stop filing default interface implementation API proposals in CoreFX, until the feature exists (or nearly exists).
I am also looking forward to it, but we need to understand all its implications on CoreFX - don't forget that CoreFX is also used for Xamarin (active port in progress), UWP and Desktop. Also some code ships downlevel from CoreFX - we have to avoid to use it there.
Overall we will have to come up with a holistic plan here, before we can start looking at these proposals one by one.

If it helps you, feel free to file a one uber-issue and list there APIs you want to keep track of. I would be ok with that.

Closing for now.

@karelz karelz closed this as completed Mar 7, 2017
@karelz
Copy link
Member

karelz commented Mar 7, 2017

cc @ianhays @safern

@dmitriyse
Copy link
Author

Ok, sorry. I understand you.

@karelz
Copy link
Member

karelz commented Mar 7, 2017

Ok, sorry. I understand you.

Thanks for understanding! Please do not view it as discouragement from contributions - we appreciate community contributions, incl. API proposals. The only problem is timing of your proposals - you are a bit ahead of the game and Roslyn :)

If you are interested in immediate actionable contributions, I would recommend to look at:

@msftgits msftgits transferred this issue from dotnet/corefx Jan 31, 2020
@msftgits msftgits added this to the 2.0.0 milestone Jan 31, 2020
@ghost ghost locked as resolved and limited conversation to collaborators Dec 25, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
api-needs-work API needs work before it is approved, it is NOT ready for implementation area-System.Collections
Projects
None yet
Development

No branches or pull requests

3 participants