You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
if(collection is[..,99,100])// matches on the last two elements onlyif(collection is[1,2, ..])// matches on the first two elementsif(collection is[1, ..,100])// matches the first and last elements
The text was updated successfully, but these errors were encountered:
@ufcpp I'd say that would be a very limited helper, to only match first and last element. Note that the slice pattern could appear anywhere in the list pattern (first, last, or anywhere in between). Consider a list pattern with more that one element to match. You'd need N Deconstruct overloads to make that work, and still since all Deconstruct overloads must differ in parameter counts, you'd be limited to a particular set of overloads.
This would be an increment on the "list pattern" proposal (#1039)
->
..
expansion should work with any type with a range indexer...
expansion would be the return type of the indexer, e.g.Span<int>
here...
expansion would be allowed in the pattern...
as an standalone pattern to skip elements.The text was updated successfully, but these errors were encountered: