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

Make Type implement IEquatable<Type> #31171

Open
TylerBrinkley opened this issue Oct 15, 2019 · 2 comments
Open

Make Type implement IEquatable<Type> #31171

TylerBrinkley opened this issue Oct 15, 2019 · 2 comments
Labels
api-needs-work API needs work before it is approved, it is NOT ready for implementation area-System.Reflection needs-further-triage Issue has been initially triaged, but needs deeper consideration or reconsideration
Milestone

Comments

@TylerBrinkley
Copy link
Contributor

I'm not sure why this hasn't been done as Type already has an Equals(Type) method but I'd like Type to implement IEquatable<Type> so I can use Type as a type argument where there's a generic type constraint of IEquatable<T> such as in DictionarySlim.

@terrajobst
Copy link
Member

terrajobst commented Oct 22, 2019

Video

What about other types in the MemberInfo hierarchy?

@steveharter what are you thoughts?

@TylerBrinkley
Copy link
Contributor Author

Just from a cursory look at the other derived types of MemberInfo, e.g. EventInfo, FieldInfo, MethodInfo, ConstructorInfo, and PropertyInfo, none of those include an equivalent Equals(T) method just an override of Equals(object).

Is the concern that we might want to make MemberInfo implement IEquatable<MemberInfo>? Would that cause issues if we also made Type implement IEquatable<Type>? If so I think we should prefer implementing the interface on Type as it's abundantly more common and the only derived type of MemberInfo that resides in the System namespace and as such should get preferential treatment.

@msftgits msftgits transferred this issue from dotnet/corefx Feb 1, 2020
@maryamariyan maryamariyan added the untriaged New issue has not been triaged by the area owner label Feb 23, 2020
@layomia layomia added this to the Future milestone Jun 24, 2020
@layomia layomia removed the untriaged New issue has not been triaged by the area owner label Jun 24, 2020
@steveharter steveharter added the needs-further-triage Issue has been initially triaged, but needs deeper consideration or reconsideration label Oct 21, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
api-needs-work API needs work before it is approved, it is NOT ready for implementation area-System.Reflection needs-further-triage Issue has been initially triaged, but needs deeper consideration or reconsideration
Projects
No open projects
Development

No branches or pull requests

6 participants