Skip to content

Avoid StringSegment conversions #56533

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

Merged
merged 1 commit into from
Jul 22, 2024
Merged

Conversation

martincostello
Copy link
Member

Avoid StringSegment conversions

Avoid implicit conversions from string to StringSegment.

Description

Avoid 1 or 2 implicit conversions to StringSegment from string per invocation of StringWithQualityHeaderValueComparer.Compare() by re-using a static field.

Avoid 1 or 2 implicit conversions to `StringSegment` from `string` per invocation of `StringWithQualityHeaderValueComparer.Compare()` by re-using a static field.
@ghost ghost added the area-networking Includes servers, yarp, json patch, bedrock, websockets, http client factory, and http abstractions label Jun 30, 2024
@dotnet-policy-service dotnet-policy-service bot added the community-contribution Indicates that the PR has been added by a community member label Jun 30, 2024
@dotnet-policy-service dotnet-policy-service bot added the pending-ci-rerun When assigned to a PR indicates that the CI checks should be rerun label Jul 8, 2024
@martincostello martincostello reopened this Jul 8, 2024
@martincostello martincostello removed the pending-ci-rerun When assigned to a PR indicates that the CI checks should be rerun label Jul 8, 2024
@dotnet-policy-service dotnet-policy-service bot added this to the 9.0-preview7 milestone Jul 8, 2024
Copy link
Member

@amcasey amcasey left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks!

@@ -14,6 +14,8 @@ namespace Microsoft.Net.Http.Headers;
/// </summary>
public class StringWithQualityHeaderValueComparer : IComparer<StringWithQualityHeaderValue>
{
private static readonly StringSegment Any = new("*");
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I might call it "AnyQuality", but I don't feel strongly about it.

@martincostello
Copy link
Member Author

Good to merge?

@amcasey
Copy link
Member

amcasey commented Jul 22, 2024

Sorry, I was giving the other reviewers a little time, but things have been crazy here and no one's had time.

@amcasey amcasey merged commit 65cc716 into dotnet:main Jul 22, 2024
27 checks passed
@martincostello martincostello deleted the avoid-conversion branch July 22, 2024 15:53
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area-networking Includes servers, yarp, json patch, bedrock, websockets, http client factory, and http abstractions community-contribution Indicates that the PR has been added by a community member
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants