Request.QueryString Question.
-
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.
-
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.
There is no difference. The
Item
property get method (that you use in the first case) just calls theGet
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 theGetValues
method, and that one is different. It returns the values as a string array instead of concatenating them together as a comma separated list.Despite everything, the person most likely to be fooling you next is yourself.
-
There is no difference. The
Item
property get method (that you use in the first case) just calls theGet
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 theGetValues
method, and that one is different. It returns the values as a string array instead of concatenating them together as a comma separated list.Despite everything, the person most likely to be fooling you next is yourself.
Excellent. Thank you. Just something I've been wondering about. Thanks again!