Click here to Skip to main content
Rate this: bad
good
Please Sign up or sign in to vote.
See more: C#
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 29-Nov-08 19:13pm

1 solution

Rate this: bad
good
Please Sign up or sign in to vote.

Solution 1

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.

  Permalink  
  Print Answers RSS
0 Kornfeld Eliyahu Peter 420
1 OriginalGriff 254
2 Nelek 115
3 Gihan Liyanage 99
4 Sergey Alexandrovich Kryukov 99
0 Kornfeld Eliyahu Peter 420
1 OriginalGriff 140
2 Gihan Liyanage 99
3 Nelek 65
4 sankarsan parida 65


Advertise | Privacy | Mobile
Web01 | 2.8.140827.1 | Last Updated 30 Nov 2008
Copyright © CodeProject, 1999-2014
All Rights Reserved. Terms of Service
Layout: fixed | fluid

CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100