Request.QueryString问题. [英] Request.QueryString Question.

查看:84
本文介绍了Request.QueryString问题.的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

这并不是我真正需要帮助的东西,但更多的是想知道为什么或从有经验的程序员那里寻求更好的方法.

Request.QueryString ["..."];
<或

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


两者都有原因吗?使用.Get是否可以节省不必要的时间,而不必意识到它需要获取"查询字符串?只是一个愚蠢的问题困扰着我,所以我决定问问.

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.

推荐答案

没有什么区别. Item属性的get方法(在第一种情况下使用)仅调用Get方法.

两者都存在的原因可能是支持不能使用索引器的编程语言(第一个

获得值的另一种方法是GetValues方法,并且一个 是不同的.它将值作为字符串数组返回,而不是将它们作为逗号分隔的列表连接在一起.

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.


这篇关于Request.QueryString问题.的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆