Click here to Skip to main content
15,889,858 members
Please Sign up or sign in to vote.
5.00/5 (1 vote)
See more:
This isn't really something I need help on, but more wondering why or which way is better from asking experienced programmers.

Request.QueryString["..."];

or

Request.QueryString.Get("....");


Is there a reason for both of them? Does using the .Get save it time from not having to realize it needs to "Get" the query string? Just a silly question that has been bugging me so I've decided to ask.
Posted

1 solution

There is no difference. The Item property get method (that you use in the first case) just calls the Get method.

The reason that both exists is probably to support programming languages that can not use an indexer (the first alternative).

Another alternative to get the values is the GetValues method, and that one is different. It returns the values as a string array instead of concatenating them together as a comma separated list.

 
Share this answer
 


CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900