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

[C#] Implement IReadOnlyList<T?> on scalar arrays #38348

Closed
CurtHagenlocher opened this issue Oct 19, 2023 · 0 comments · Fixed by #38680
Closed

[C#] Implement IReadOnlyList<T?> on scalar arrays #38348

CurtHagenlocher opened this issue Oct 19, 2023 · 0 comments · Fixed by #38680

Comments

@CurtHagenlocher
Copy link
Contributor

Describe the enhancement requested

Arrow arrays of scalar type T implement the same semantic contract as IReadOnlyList<T?>. If they were to implement this contract then they could be used in existing code which expects arrays of that type. If they were also to implement ICollection<T?>, it would optimize their use with LINQ (pre-.NET 9), allowing for e.g. fast conversion to lists via the extension method ToList().

This change would to some extent supersede and/or resolve #23892, #35199 and #37359.

Component(s)

C#

CurtHagenlocher pushed a commit that referenced this issue Nov 19, 2023
### What changes are included in this PR?

Make Arrow arrays of scalar type T implement the same semantic contract as IReadOnlyList<T?>.
Note that this PR does not include similar support for ICollection<T?>. I could add that support in this PR or a future PR.

### Are these changes tested?

This PR includes unit tests of the implemented IReadOnlyList<T?> methods.
* Closes: #38348

Authored-by: voidstar69 <[email protected]>
Signed-off-by: Curt Hagenlocher <[email protected]>
@CurtHagenlocher CurtHagenlocher added this to the 15.0.0 milestone Nov 19, 2023
@CurtHagenlocher CurtHagenlocher changed the title [C#] Implement IReadOnlyList<T?> and ICollection<T?> on scalar arrays [C#] Implement IReadOnlyList<T?> on scalar arrays Jan 15, 2024
dgreiss pushed a commit to dgreiss/arrow that referenced this issue Feb 19, 2024
…apache#38680)

### What changes are included in this PR?

Make Arrow arrays of scalar type T implement the same semantic contract as IReadOnlyList<T?>.
Note that this PR does not include similar support for ICollection<T?>. I could add that support in this PR or a future PR.

### Are these changes tested?

This PR includes unit tests of the implemented IReadOnlyList<T?> methods.
* Closes: apache#38348

Authored-by: voidstar69 <[email protected]>
Signed-off-by: Curt Hagenlocher <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant