Skip to content
This repository was archived by the owner on Jan 23, 2023. It is now read-only.

added implicit cast operator from ArraySegment to Spans#7297

Merged
jkotas merged 2 commits intodotnet:SpanOfTfrom
adamsitnik:arraySegmentToSpan
Sep 21, 2016
Merged

added implicit cast operator from ArraySegment to Spans#7297
jkotas merged 2 commits intodotnet:SpanOfTfrom
adamsitnik:arraySegmentToSpan

Conversation

@adamsitnik
Copy link
Member

Discussion, corefxlab PR

I did not use public getter's of ArraySegment (Array, Offset, Count) because they contain code contracts that would be duplicated by the constructors of Spans. Moreover the ctor of Span is more demanding because it additionaly checks for covariance. That's why I decided to avoid double checks and made the fields of ArraySegment internal.

@jkotas @KrzysztofCwalina

@jkotas
Copy link
Member

jkotas commented Sep 21, 2016

because they contain code contracts that would be duplicated by the constructors of Spans

These contracts are debug-only. There should be no harm in using the existing assessors.

@adamsitnik
Copy link
Member Author

These contracts are debug-only. There should be no harm in using the existing assessors.

@jkotas thanks for explanation. I updated the code

@jkotas
Copy link
Member

jkotas commented Sep 21, 2016

👍

@jkotas jkotas merged commit 9d22207 into dotnet:SpanOfT Sep 21, 2016
jkotas pushed a commit to jkotas/coreclr that referenced this pull request Oct 29, 2016
jkotas pushed a commit to jkotas/coreclr that referenced this pull request Oct 29, 2016
jkotas pushed a commit to jkotas/coreclr that referenced this pull request Oct 29, 2016
jkotas pushed a commit to jkotas/coreclr that referenced this pull request Oct 29, 2016
jkotas pushed a commit to jkotas/coreclr that referenced this pull request Oct 31, 2016
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants