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

Remove Castle.Core.Internal.CollectionExtensions #563

Merged
merged 1 commit into from
Jan 20, 2021

Conversation

stakx
Copy link
Member

@stakx stakx commented Jan 19, 2021

Closes #560.

Its five methods are dealt with as follows:

  • Find, IsNullOrEmpty: unused.

  • FindAll: used only once, inlined.

  • GetContentsHashCode, AreEquivalent: used to implement equality contract in ProxyGenerationOptions. Moved there, mostly unchanged.

@stakx stakx added this to the v5.0.0 milestone Jan 19, 2021
@stakx stakx requested a review from jonorossi January 19, 2021 20:03
@stakx stakx changed the title Remove CollectionExtensions Remove Castle.Core.Internal.CollectionExtensions Jan 19, 2021
Its five methods are dealt with as follows:

 * `Find`, `IsNullOrEmpty`: unused.

 * `FindAll`: used only once, inlined.

 * `GetContentsHashCode`, `AreEquivalent`: used to implement equality
   contract in `ProxyGenerationOptions`. Moved there, mostly unchanged.
Comment on lines -299 to +296
result = 29*result + CollectionExtensions.GetContentsHashCode(AdditionalAttributes);
result = 29*result + GetAdditionalAttributesHashCode();
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

GetHashCode does not have to be precise (only fast), so we could just use AdditionalAttributes.Count instead of summing the attributes' hash codes. I've not done so because there are some unit tests affected by it; someone in the past must have thought it important that options.GetHashCode differ for different attributes.

Copy link
Member

@jonorossi jonorossi left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That was easy 😄

@stakx stakx merged commit 8d0b4e4 into castleproject:master Jan 20, 2021
@stakx stakx deleted the collection-extensions branch January 20, 2021 06:26
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

Successfully merging this pull request may close these issues.

Please make Castle.Core.Internal.CollectionExtensions internal because it shows up in IntelliSense
2 participants