开发者

Performance cost when using RouteData.Values instead of querystring collection

开发者 https://www.devze.com 2023-03-25 23:25 出处:网络
Would there be any noticeable performance cost when doing this: HttpContext.Current.Request.RequestConte开发者_JAVA百科xt.RouteData.Values(\"key\")

Would there be any noticeable performance cost when doing this:

HttpContext.Current.Request.RequestConte开发者_JAVA百科xt.RouteData.Values("key")

as opposed to this:

context.Request("key")


Either way, you're just accessing a collection. The RouteData.Values dictionary will be populated whether you use it or not, as will the Request.QueryString collection. There may be some overhead using Request("key") vs Request.QueryString("key"), as the former has to check the form collection as well, but it would beyond trivial, and I think the query string is checked first anyway.

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号