Is converting a NameValueCollection to a querystring using a c# lambda efficient?

前端 未结 3 957
臣服心动
臣服心动 2021-02-20 14:59

In researching how to convert a NameValueCollection to a querystring, I have come across different methods. I am curious if the shorter lambda syntax is as efficient as it coul

3条回答
  •  佛祖请我去吃肉
    2021-02-20 15:20

    NameValueCollection's ToString method will build the query string for you. I haven't done any benchmarking, but I'd imagine the implementation would be more efficient than something using lambdas or foreach.

    (The ToString solution doesn't seem to be well-documented; I only found it because this answer used it in a code sample.)

提交回复
热议问题