Skip to content
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

HttpUtility.ParseQueryString ambiguous return type. Should be HttpValueCollection instead of NameValueCollection. #10876

Open
sdimovagi opened this issue Jan 24, 2025 · 1 comment
Labels
area-System.Collections untriaged New issue has not been triaged by the area owner

Comments

@sdimovagi
Copy link

Type of issue

Other (describe below)

Description

The HttpUtility.ParseQueryString(...) states that the return value is NameValueCollection while in fact it returns HttpValueCollection.

HttpValueCollection derives from NameValueCollection and techincally 'is' NameValueCollection,
The HttpValueCollection.ToString() implementation is quite different form the one in NameValueCollection.
The HttpUtility.ParseQueryString(...) documentation implies one can create new NameValueCollection() instead of calling the method, and it will behave the same way.

E.g. based on the documentation the code blow should produce the same result.
var query = HttpUtility.ParseQueryString("");
query["message"] = message;
query.ToString();

var query = new NameValueCollection();
query["message"] = message;
query.ToString();

Page URL

https://learn.microsoft.com/en-us/dotnet/api/system.web.httputility.parsequerystring?view=net-9.0

Content source URL

https://github.com/dotnet/dotnet-api-docs/blob/main/xml/System.Web/HttpUtility.xml

Document Version Independent Id

cab0e9f7-1984-a4d4-bbdc-ec6a45ef1159

Article author

@Rick-Anderson

@dotnet-policy-service dotnet-policy-service bot added the untriaged New issue has not been triaged by the area owner label Jan 24, 2025
Copy link
Contributor

Tagging subscribers to this area: @dotnet/area-system-collections

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area-System.Collections untriaged New issue has not been triaged by the area owner
Projects
None yet
Development

No branches or pull requests

1 participant