Skip to content

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 force-pushed the collection-extensions branch from 286ea1f to b42bc55 Compare January 19, 2021 20:01
@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.
@stakx stakx force-pushed the collection-extensions branch from b42bc55 to 9168acf Compare January 19, 2021 20:18
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