Skip to content

Improve HttpUtility.ParseQueryString formatting and code snipped for C# #9251

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

Closed
JoanGil opened this issue Sep 5, 2023 · 10 comments · Fixed by #9342
Closed

Improve HttpUtility.ParseQueryString formatting and code snipped for C# #9251

JoanGil opened this issue Sep 5, 2023 · 10 comments · Fixed by #9342
Labels
area-System.Net.Http doc-enhancement Improve the current content Pri3 Indicates issues/PRs that are low priority
Milestone

Comments

@JoanGil
Copy link
Contributor

JoanGil commented Sep 5, 2023

Hi all!

I checked the HttpUtility.ParseQueryString method documentation and I realized that some of the formatting and variable naming could be greatly improved.

I could create a pull request and change these things if that's okay.

image

@issues-automation issues-automation bot added the Pri3 Indicates issues/PRs that are low priority label Sep 5, 2023
@ghost ghost added the untriaged New issue has not been triaged by the area owner label Sep 5, 2023
@ghost
Copy link

ghost commented Sep 5, 2023

I couldn't figure out the best area label to add to this issue. If you have write-permissions please help me learn by adding exactly one area label.

@ghost ghost added the needs-area-label An area label is needed to ensure this gets routed to the appropriate area owners label Sep 5, 2023
@Anttrap63
Copy link

.____

@ghost
Copy link

ghost commented Sep 11, 2023

Tagging subscribers to this area: @dotnet/ncl
See info in area-owners.md if you want to be subscribed.

Issue Details

Hi all!

I checked the HttpUtility.ParseQueryString method documentation and I realized that some of the formatting and variable naming could be greatly improved.

I could create a pull request and change these things if that's okay.

image

Author: JoanGil
Assignees: -
Labels:

untriaged, Pri3, area-System.Net.Http, needs-area-label

Milestone: -

@buyaa-n buyaa-n removed the needs-area-label An area label is needed to ensure this gets routed to the appropriate area owners label Sep 11, 2023
@MichaelDeutschCoding
Copy link
Contributor

I would also note that this sample does not provide an easy way to run it and actually see the results, in particular the fact that:

Multiple occurrences of the same query string variable are consolidated in one entry of the returned NameValueCollection.

Would it be simpler to just remove all the Asp.Net specific renderings, and just Console.WriteLine() the results -- making it easier for readers to just copy and run. This would also allow including something like "output would look something like this: " within the snippet itself. That seems to be the approach I've seen in many other snippets.

@JoanGil
Copy link
Contributor Author

JoanGil commented Sep 12, 2023

I would also note that this sample does not provide an easy way to run it and actually see the results, in particular the fact that:

Multiple occurrences of the same query string variable are consolidated in one entry of the returned NameValueCollection.

Would it be simpler to just remove all the Asp.Net specific renderings, and just Console.WriteLine() the results -- making it easier for readers to just copy and run. This would also allow including something like "output would look something like this: " within the snippet itself. That seems to be the approach I've seen in many other snippets.

I completely agree with you. I could redo the code with better and simpler examples. What do you think? Also, @MichaelDeutschCoding do you know if I can already make the pull request or is it better to wait until someone from Microsoft "allows" it? And thanks for the response and the good suggestions!

@MichaelDeutschCoding
Copy link
Contributor

From what I've seen, I think it's fine to open a PR, and then get input from someone on the team on the changes you make. Generally, they're more than happy for community contributions.

Here's one example of snippets that include the sample output. You can include something like that in this snippet as well.

If you do change the language to C# (as opposed to the current aspx-csharp), make sure to update that reference to the snippet as well as changing the extension from .aspx to .cs.

(If you're up to it, you may want to try updating the Visual Basic example as well 👍)

@JoanGil
Copy link
Contributor Author

JoanGil commented Sep 13, 2023

Okay, thanks for the detailed reply with all the information. I will give it a try!

@JoanGil
Copy link
Contributor Author

JoanGil commented Sep 14, 2023

One more question, maybe you know @MichaelDeutschCoding do you know, once all the changes are made, how to test the solution and see if the result is correct? I can't find the information anywhere in this repo... Thanks!

@MichaelDeutschCoding
Copy link
Contributor

Personally, I use a program called LinqPad to run small snippets like this and confirm they work as I expect. Also helpful if you'd want to copy/paste the output to display it in the snippet.

You can also find online platforms that can run .NET code. The official Microsoft one is Try .NET (see more about it here). And .NET Fiddle is an older site that many people use which provides similar functionality.

You can even embed a Try .NET window into this documentation page to allow users to run your sample directly in their browser without having to even open another tab! Just add interactive="try-dotnet" when you reference the snippet from the documentation Xml file. (See an example of that usage here, and how that page appears in your browser.)

@JoanGil
Copy link
Contributor Author

JoanGil commented Sep 14, 2023

Thanks for all the information, that's very helpful. But my question was more about the dotnet-api-docs. I don't know how to test that my new files and all the documentation fit all together.

@krwq krwq added the doc-enhancement Improve the current content label Nov 7, 2023
@krwq krwq added this to the Backlog milestone Nov 7, 2023
@ghost ghost removed the untriaged New issue has not been triaged by the area owner label Nov 7, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area-System.Net.Http doc-enhancement Improve the current content Pri3 Indicates issues/PRs that are low priority
Projects
None yet
Development

Successfully merging a pull request may close this issue.

5 participants