Performance cost when using RouteData.Values instead of querystring collection
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.
精彩评论