Skip to content

Conversation

@hhvrc
Copy link
Contributor

@hhvrc hhvrc commented Feb 13, 2025

This will reduce the risk of multiple enumeration crashes and probably improve performance

This will reduce the risk of multiple enumeration crashes and probably improve performance
@hhvrc hhvrc requested a review from LucHeart February 13, 2025 13:55
@hhvrc hhvrc self-assigned this Feb 13, 2025
@LucHeart
Copy link
Member

im not entirely sure what would make you think it causes Crashes?

If anything this just imcreases heap allocations, especially in places where you now Return Array instead of an IEnumerable

@hhvrc
Copy link
Contributor Author

hhvrc commented Feb 13, 2025

Oh, it wont exactly crash but multiple enumeration is not that good...
Most places ive changed from IEnumerable<> to array, ICollection<> or IList<> ive made sure it will not negativley impact the allocations.
When ASP.NET controllers allocate a binded model for a controller it will allocate anyways behind the ienumerable

@hhvrc
Copy link
Contributor Author

hhvrc commented Feb 13, 2025

I just noticed though that returning ienumerable from controllers will improve performance, im implementing changes...

@LucHeart LucHeart merged commit faa1173 into develop Mar 10, 2025
8 checks passed
@LucHeart LucHeart deleted the feature/decrease-ienumerable-usage branch March 10, 2025 21:53
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.

3 participants