QueryStringEnumerable now works in terms of ReadOnlyMemory<char> #34001
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
While using the new
QueryStringEnumerable
to implement #33338, I realized it would be far more useful if the APIs were based aroundReadOnlyMemory<char>
instead ofReadOnlySpan<char>
.This doesn't incur any extra perf cost in realistic cases, because the querystring is basically always going to come from an actual
System.String
on the heap, so we can represent that asReadOnlyMemory<char>
without any further allocations.The benefit is that, now:
ref struct
, because it doesn't need to be. Feel free to do normal things with it.EncodedName
,DecodeName()
, etc.) are no longer ref structs either, so you can do things like use them as keys or values in dictionaries, or store them on the heap for any other reason without having to allocate a newstring
.I'm not aware of any drawbacks in realistic scenarios.