Get all values of a NameValueCollection to a strin

2020-05-25 05:52发布

I have the following code:

string Keys = string.Join(",",FormValues.AllKeys);

I was trying to play around with the get:

string Values = string.Join(",", FormValues.AllKeys.GetValue());

But of course that doesn't work.

I need something similar to get all the values, but I don't seem to find the appropriate code to do the same.

P.S: I do not want to use a foreach loop since that beats the purpose of the first line of code.

7条回答
不美不萌又怎样
2楼-- · 2020-05-25 06:46
string values = string.Join(",", collection.AllKeys.Select(key => collection[key]));
查看更多
登录 后发表回答