-
Notifications
You must be signed in to change notification settings - Fork 351
Closed
Labels
by designSome behavior that is intended and not an issueSome behavior that is intended and not an issuehigh-performance 🚂Issues/PRs for the HighPerformance packageIssues/PRs for the HighPerformance package
Description
Describe the bug
The indexer function Span2D<T>.Item[Range row, Range column]
is similar to Span<T>.Item[Range range]
. However, the latter returns an empty span when range
's Start
and End
both equal the length of the span. The same is not true for the former's row
and column
arguments.
Regression
Not a regression
Steps to reproduce
These lines of code cause an ArgumentOutOfRangeException
to be thrown:
var cornerOfEmptySpan2d = Span2D<int>.Empty[0..0,0..0];
var cornerOfSingleItemSpan2d = (new Span2D<int>(new[,] {{0}}))[1..1,1..1];
Whereas these do not:
var endOfEmptySpan = Span<int>.Empty[0..0];
var endOfSingleItemSpan = (new Span<int>(new[] {0}))[1..1];
Expected behavior
Span2D<int>.Empty[0..0,0..0]
and (new Span2D<int>(new[,] {{0}}))[1..1,1..1]
should return an empty Span2D.
Screenshots
No response
IDE and version
VS 2019
IDE version
No response
Nuget packages
- CommunityToolkit.Common
- CommunityToolkit.Diagnostics
- CommunityToolkit.HighPerformance
- CommunityToolkit.Mvvm (aka MVVM Toolkit)
Nuget package version(s)
8.1.0
Additional context
No response
Help us help you
No, just wanted to report this
xparadoxical
Metadata
Metadata
Assignees
Labels
by designSome behavior that is intended and not an issueSome behavior that is intended and not an issuehigh-performance 🚂Issues/PRs for the HighPerformance packageIssues/PRs for the HighPerformance package