Is it possible to split a string by ‘&’ and init a dictionary in one go or you have to use a string array first?
I want to take the url part:
?a=2&b=3
and load a dictionary<string,string>
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
Duplicate of your own question…
Best way to take all querystring pairs and init a dictionary
As womp said, HttpUtility.ParseQueryString() is your best bet.
Edit:
After doing a little digging I found the following extension method NameValueCollectionExtensions.CopyTo(this NameValueCollection, IDictionary< string, object >) that you could use to populate a true IDictionary.