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

ICsvReader returns IEnumerable instead of List #46

Open
wants to merge 3 commits into
base: main
Choose a base branch
from

Conversation

leandromoh
Copy link
Contributor

@leandromoh leandromoh commented Dec 26, 2021

Usually we should program to interfaces, not implementations, to abstract implementation details and focus on behaviour.
I think it is more fair does not obligate implementations to return a specific type (eg. List) @joelverhagen

If some implementation can work better with IEnumerable instead of List, I dont see any reason to force it get worse.

Obligate implementations to use list hurt performances unnecessarily because as the size of the list gets larger, it has the cost of creating a new buffer internally and copy over all of the existing elements.

So this PR makes 2 adjusts:

  1. adjusts to ICsvReader returns IEnumerable instead of List
  2. adjusts some implementations to use yield return instead of mandatorily return a List

I can revert point 2 if wanted.

@leandromoh leandromoh force-pushed the adjust/use-ienumerable branch from cc55d07 to 4ff58c1 Compare December 26, 2021 17:35
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.

1 participant